"The Art of Debugging with Gdb,ddd,and Eclipse" in software commissioning

Source: Internet
Author: User

#第1章 * * Specify-tui or ctrl+x+a using gdb** in TUI mode

#第2章 stopped and looked around the program
* * Breakpoint * * Notifies GDB to halt execution of program
* * Monitoring Point * * Notifies gdb to pause execution when the value of a particular memory location (or an expression involving one or more locations) changes.
* * Capture Point * * Notifies gdb to pause execution when a particular event occurs.

# # #2.4.1 Setting breakpoints in GdB # # #
Break *function*
Break *line_number*

Break *filename:function*

Break *filename:line_number*

* * Temporary Breakpoint **tbreak
#第4章 program crashes processing data related to segment errors is access to the page, which resembles file access rights: Read, Write, and execute. For example, Page 3 of a page table entry will indicate whether the process has permission to read data from the page, permission to write data to the page, and permission to execute instructions on the page.
> Each time a program uses one of its global variables, it needs to have read/access permissions to the data region.
> Each time a program accesses a local variable, the program accesses the stack and requires read/write access to the stack area.
> Each time a program enters or leaves a function, one or more accesses to the stack require a stack areahas read/write access rights.
> Heap access occurs every time a program accesses a storage created by calling malloc () or new , and requiresread/write access rights.
Each machine instruction executed by the > program is removed from the text area (or from the area of the dynamic Link code) and therefore requires a read and execute file.
#第7章 other tools have two functions that make it easier to interpret error codes: Perror () and strerror ()
>perror-example.c

int main (void)    {    FILE*FP;
    fp = fopen ("/foo/bar", "R");
    if (NULL = = fp)        perror ("I found an error");
    return 0;    }
> If there is no/foo/bar on the system, the output is as follows>>$./a.out>>i found an error:no such file or directory

__________>strerror-example.c
int main (void)    {    close (s);    printf ("%s\n", Strerror (errno));    return 0;    }
> The output of the program is as follows:>>$./a.out>>bad File Descriptor

* * Better use of strace and ltrace**
Strace The various system calls made by the output program and their parameters and return values.
Ltrace is similar to strace, but it shows a library call instead of a system call.
* * Static code checker: lint and its derivative * *

From for notes (Wiz)

"The Art of Debugging with Gdb,ddd,and Eclipse" in software commissioning

Related Article

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.