在Linux中启动GDB时如何传递命令行参数? [英] How do I pass a command line argument while starting up GDB in Linux?

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

问题描述

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



我做:

  gdb -tui InsertionSortWithErrors 

哪些工作,但之后我不知道如何传递论据。我使用 gdb -help ,它说出了一些关于 - args ,我也尝试过,它没有工作。



我想要获得调试器+ gui并传递命令行参数。

解决方案

一旦 gdb 启动,您可以使用r



所以如果你通过以下方式运行你的代码:

  $ executablefile arg1 arg2 arg3 

gdb上调试gdb

  $ gdb可执行文件
(gdb)r arg1 arg2 arg3


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.

I do:

gdb -tui InsertionSortWithErrors

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.

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

解决方案

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

So if you are running your code by:

$ executablefile arg1 arg2 arg3 

Debug it on gdb by:

$ gdb executablefile  
(gdb) r arg1 arg2 arg3

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

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