How GDB saves and reads breakpoints

Source: Internet
Author: User

The students who have just started programming with GDB in Linux may find that each time you use GDB to set a breakpoint debug program, but the next time you open it, all breakpoints are gone, it's inconvenient. The methods for saving and reading breakpoints are described below.

1. Save Breakpoints

First Use info B to view the currently set breakpoints, use the Save Breakpoint command to save to the specified file, where I use the and process name plus the BP suffix, you can take the name you like.

I'm using save breakpoint FIG8.3.BP.

2. Read breakpoints

Note that, while GDB has already loaded the process, it is not able to read the breakpoint file, you must specify the breakpoint file in the GDB load File command, specifically using the-x parameter. For example, I need to debug fig8.3 this file, specifying the breakpoint file fig8.3.bp just saved.

I'm using GdB fig8.3-x fig8.3.bp.

Note that the files you are debugging need to be compiled with the-G parameter to be able to debug oh.

OK, other debugging methods I will be on the way.

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.