GDB multi-thread debugging

Source: Internet
Author: User

Set the Core Environment
Uname-a view Machine Parameters
Ulimit-a view default parameters
Ulimit-C 1024 sets the core file size to 1024
Ulimit-C unlimit: Set the core file size to unlimited.

Multi-thread dump is often a segment error, which generally involves illegal memory read/write. You can use the following command to enable the system switch so that it can generate
Core File.
Ulimit-C Unlimited

 

Thread debugging command
(GDB) info threads
Display All the currently debuggable threads. Each thread has an ID allocated to it by GDB, which will be used in subsequent thread operations.
There are * threads currently being debugged.

(GDB) thread ID
Switch the thread of the current debugging to the thread with the specified ID.

(GDB) thread apply id1 Id2 command
Let one or more threads execute the gdb command.
(GDB) thread apply all command
Let all the debugging threads execute the gdb command.

(GDB) set scheduler-locking off | on | step
It is estimated that all users who have used multi-thread debugging can find that when using the step or continue command to debug the currently debugged thread, other threads also execute at the same time, how can I only execute the program to be debugged? You can use this command to achieve this requirement.
Off does not lock any thread, that is, all threads are executed. This is the default value.
On is executed only by the currently debugged program.
Step in a single step, except for the next function (people familiar with the situation may know that this is actually an action to set the breakpoint and then continue, only the current thread will execute.

// Display thread stack information
(GDB) BT
View All call stacks

(GDB) F 3
Call box level

(GDB) I locals
Display all variables of all current call stacks

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.