Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of GDB

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Note:

Gcc-g-c main.c

Gcc-o main main.o

To generate an executable that can be debugged, you need to add the-g option at compile time, not at link time. If there is no-g, you will not see the function name, variable name of the program, all replaced by the running memory address.

open

Gdb

Set breakpoint

Break

Run the program

Run

Displays 10 lines of code adjacent to the breakpoint

List

Single-step debugging (inside or outside the function)

"next" strictly ensures that the control point is in the current range, while "step" follows the execution into the interior of the function.

If the breakpoint is set on the line where the function is called, use the next control point to jump directly to the next line. If you use the step control point, it jumps to the first line inside the function.

Check variable

Print

Modify variable

Set =

Set up a monitoring point

Watch

Quit

If you want to exit your program when it is paused, use the "kill" command, and if you want to exit GDB, use the "quit" command

For specific example analysis, please refer to the following blog post.

Reference: https://blog.csdn.net/hrzr79011/article/details/41900239

Https://blog.csdn.net/SKY453589103/article/details/47292697 (such as invading and deleting)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report