GDB debugging Learning (1)

Source: Internet
Author: User

Read the art of debugging
GDB,Ddd, AndEclipseIn the form of knowledge points. This book is very detailed and is a good introductory debugging book. However, books starting with "the art" do not have enough weight.

------------- Debugging basics ------------------

1. GDB: GNU Project debugger, a debugger for projects based on Linux platform; DDD: Data Display debbuger; data display debugger; it is a GUI of GDB, interacts with GDB through command lines, and provides a direct GDB command line Input window.

2. segmented comments based on the Binary Search MethodSource code, Locate bugs

3. GDB targets machine language commands instead of SourceCodeLine, a line of source code may correspond to several lines of machine language. Source code lines can be used for GDB that can be debugged in one step because the executable file contains additional information.

4. What is the difference between a monitoring point and a breakpoint? Although all are paused under certain conditionsProgramBut the breakpoint is associated with the location in the source code, and the monitoring point is associated with the variable life cycle.

5. (GDB) print display command call

6. Program crash: The hardware will perceive that the program tries to access a memory unit without permission and perform a jump to the Operating System (core dump)

7. strace: trace all system calls performed by a process, similar to ltrace: trace the database functions called by the process.

8. You can use the open-source Ethereal program to track individual TCP/IP groups in complex network debugging scenarios.

9. GDB coredump call process:

$ GDB exefile Core

(GDB) backstrace

#0 0x400a925 in strcpy () from/lib/libc. so.6

#1 0x084084df in init_string from ....

#2 0x084085e4 in main ....

10. During debugging, you do not need to exit GDB to modify the code, saving startup time and retaining breakpoints.

------------ Multi-activity context debugging -------------------------

11. info threads: displays information about all current threads,

Thread 3: change the current thread to 3;

Break 88 thread 3: When thread 3 reaches 88, the execution is paused,

Break 88 thread 3 if x = Y: When thread 3 reaches line 88 of the source code and the variable X and Y are equal, the execution is stopped.

12. There are two main parallel programming frameworks: Shared Memory and message transmission. Among them, the underlying implementation of multi-threaded programming is shared memory. The typical implementations of shared memory and message passing are OpenMP and MPI packages.

13. splint: a tool used to dynamically check the security vulnerabilities of C language programs and write errors, similar to cppcheck for C ++

14. valgrind: a Linux-based software development tool for memory debugging, memory leak detection, and Performance Analysis

15. gcj: Compile the Java source code as the local machine code. Therefore, you can use GDB for debugging and use the conditional breakpoint. This is more powerful than jdb, and you do not need to learn a new debugger, the running speed is also faster.

16. swig: Simplified wrapper and interface generator: Package and compile the software written in C/C ++.Programming Language(Especially in the script language.

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.