简体   繁体   English

gdb调试器多个源文件

[英]gdb debugger multiple source files

When I attach gdb to a process that uses many source files, such as PHP, sometimes I want to set a breakpoint on line x of file y. 当我将gdb附加到使用许多源文件(例如PHP)的进程时,有时我想在文件y的第x行上设置断点。 How do I specify the file for gdb? 如何为gdb指定文件?

It's as simple as: 它很简单:

b filename.c:XYZ

See the documentation for more info. 有关详细信息,请参阅文档

  1. gdb ./test.exe //test.exe is create by you program. gdb ./test.exe //test.exe由您的程序创建。
  2. b 117 //if only single file and line 117 is the function you want to run into b filename.c:110 //filename:line NO b 117 //如果只有单个文件和第117行是你想要运行的函数b filename.c:110 // filename:line NO
  3. r //running the prog r //运行prog
  4. n
  5. c //continue c //继续
  6. s //sign in the function you want to test s //登录您要测试的功能
  7. until 1120 //if there is for branch and you want to skip the brand, given 1120 is after the for branch until 1120 //如果for分支,你想跳过这个品牌,因为1120后for分支

You can shorten almost all commands in GDB up to the point where they remain unambiguous. 您可以将GDB中的几乎所有命令缩短到它们保持明确的程度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM