我如何通过命令行参数,而在Linux的启动GDB? [英] How do I pass a command line argument while starting up GDB in Linux?

查看:125
本文介绍了我如何通过命令行参数,而在Linux的启动GDB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要调试,在有错误,我的任务的一部分的程序。但是,我必须先通过命令行参数,以解决这个问题。

I have to debug a program that has errors in it as part of my assignment. However, I must first pass command line arguments in order to solve this problem.

我做的:

gdb -tui InsertionSortWithErrors

该作品,但之后,我不知道如何来传递参数。我用 GDB -help 和它说一些有关这--args我也尝试过,并没有工作。

which works but after that I don't know how to pass arguments. I used gdb -help and it says something about --args which I also tried and it didn't work.

我希望能够得到调试+ GUI和传递命令行参数。

I want to be able to get the debugger+the gui and pass command line arguments.

有人能帮助我吗?

我不认为该计划是对这个问题真正相关的,但我将发布它,如果要求。

I don't think the program is really relevant to this question but I will post it up if requested.

推荐答案

GDB 启动后,可以使用运行程序 - [R的 ARGS 的。

Once gdb starts, you can run the program using "r args".

所以,如果你运行你的code:

So if you are running your code by:

$ executablefile arg1 arg2 arg3 

调试它 GDB

$ gdb executablefile  
(gdb) r arg1 arg2 arg3

这篇关于我如何通过命令行参数,而在Linux的启动GDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆