GDB uses checkpoint to reproduce bugs

Source: Internet
Author: User

Today interview was asked a question, how to debug multi-process program, I answered GDB attach [PID], and then asked if some of the program data read wrong, but this phenomenon is accidental, this time to how to operate, then was ignorant ..., by looking up the data to find the answer, Now write down the blog post.

Checkpoint

  Sometimes the occurrence of a bug occurs accidentally, if there is something to save the current state is good, in gdb, using checkpoint, GDB can save the moment of the program State or program image ( in addition to the process number and the output of the content ), And can return to the state of the program again, each checkpoint has a unique process ID, which is different from the PID of the original program, so if the program needs to use PID information, it needs to be considered carefully.

  Use the snapshot using the following command:

Checkpoing: Generate a snapshot of the current state

Info checkpoint: Displaying snapshot information

Restart Checkpoint-id: revert to a checkpoint

    Delete Checkpoint Checkpoint-id: Delete a checkpoint

  

GDB uses checkpoint to reproduce bugs

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.