Parsing of GDB and Coredump error class files

Source: Internet
Author: User

                     GDB与coredump错误类文件的解析  GDB是Linux与UNIX系统下的一款程序调试工具,下面来介绍GDB的用法:

Please look at this program first:

This is our experiment as a small program, a total of 10 lines of output 4

To compile if you want to debug with GDB, you must add the-G parameter

This is the normal operation of the compiled file

Start Debugging this program gdb plus file name

Now introduce the first parameter L (list) is to display the contents of the program, L can also add a number, that is, print the number of rows up and down a total of 10 rows.

The start program starts with one-step debugging and automatically executes the first step.

Parameter B Set a breakpoint is the program function to pause waiting for the next step of the instructions, B 5 is to set a breakpoint in line fifth, especially if this line is a blank line, it will automatically jump to the next line, so set the breakpoint is not an absolute breakpoint, r parameter (run) is to run the program, one step run or to a breakpoint pause, Use R and B parameters to run the program as you like.

Info B View the number and condition of the breakpoint, the Del line number, delete the line number that has been set, and the breakpoint that should be set will persist (please note this)

The parameter C program continues execution until it encounters the next breakpoint pause, N does not enter the child function for single-step operation, and S enters the child function for single-step operation.
P Prints a value, set assigns a value to a value.
Attention:
System functions cannot be debugged in one step
Rows with no initial values will also be skipped automatically

     现在介绍有段错误文件的调试,一般操作系统并不开生成错误文件这个选项,因为这回产生很多的垃圾文件,我们可以通过     ulimit -c unlimited 开启生成coredump文件。想要永久生效请修改,配置文件:  bash.profile /etc/profile 或者/etc/security/limits.conf     然后 echo"/corefile/core-%e-%P-%t"> /proc/sys/kernel/core_pattern  产生的core文件名为core-进程名-PID-时间戳 %h添加主机名     然后就可以调试了gdb coredump 段错误文件就可以看到程序出错最后的栈的信息了。

Parsing of GDB and Coredump error class files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.