gpt4 book ai didi

linux - 一步步执行

转载 作者:太空狗 更新时间:2023-10-29 12:21:39 26 4
gpt4 key购买 nike

如何在Linux中一步一步执行,我想查看所用变量的内容,地址和指针所持有的值

最佳答案

通过给出 -g 标志来编译你的程序。这将为您的程序创建调试信息(符号)。

gcc -g -o foo foo.c

然后使用您选择的调试器运行程序。下面是一个使用 gdb

的例子
# gdb foo
# b main --> this will set the break point at main function.
# r --> start running your program. If you want to pass some argument, use: r <args>
# n --> to goto next line of execution
# print <var> --> to print variable value
# help --> for list of supported commands.

关于linux - 一步步执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4590891/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com