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

How to use the gdb command of Linux

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people do not understand the knowledge of this article "how to use the gdb command of Linux", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use the gdb command of Linux" article.

Linux common commands gdb commands are included in GNU's gcc development kit and are powerful program debuggers.

Syntax format gdb [parameters] [file]

Common parameters:-cd sets working directory-Q quiet mode, does not print introduction and version information-d adds file lookup path-x executes GDB instruction from specified file-s setting reads symbol table file common commands:

File load the executable program file being debugged run restart to run the file start step execution, run the program, stop at the first execution statement list to view the original code, abbreviate lset to set the value of the variable next step debugging (step by step Function execution directly), nstep step debugging (sentence by sentence: jump into the custom function), sbacktrace to view the stack frame and hierarchical relationship of the function call, btframe to switch the stack frame of the function, finfo to view the value of the local variables inside the function, ifinish to end the current function, return to the function call point continue to continue running, cprint print value and address, pquit to exit gdb, Q to display details

The gdb command has more internal commands. Enter "help" at the gdb command prompt "(gdb)" to view all internal commands and instructions. To debug a program using gdb, you must add the "- g" parameter when compiling the source code using gcc.

Start the gdb debugger with reference to the example:

[root@linux265 ~] # gdb (gdb) loads the binary executable program:

(gdb) file linux265.out runs and tracks the program:

(gdb) the above start is about the content of this article on "how to use the gdb command of Linux". I believe you all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

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

Development

Wechat

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

12
Report