Setting Breakpoints

Debugging tools typically offer a variety of mechanisms with which to set breakpoints.

Setting Breakpoints in GDB

You've learned that GDB gives the illusion of running a program line by line of source code. You've also learned that in order to do anything really useful with GDB you need to instruct it where to pause execution so you can perform debugging activitites with GDB's command-line prompt. In this section, you'll learn how to set breakpoints, which tell GDB where to stop within your source code.

There are many different ways to specify a breakpoint in GDB; here are some of the most common methods:

break function

Set a breakpoint at the entry (first executable line) of the function function(). You saw an example ...

Get The Art of Debugging with GDB, DDD, and Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.