This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: how to set breakpoint at a particular line in cpp file
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: n179911 <n179911 at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Wed, 18 Nov 2009 23:10:16 -0800
- Subject: Re: how to set breakpoint at a particular line in cpp file
- References: <3b9893450911182243o2b078ac0w4e86ab1464aeaa0d@mail.gmail.com>
On Wed, Nov 18, 2009 at 10:43 PM, n179911 <n179911@gmail.com> wrote:
> How to set breakpoint at a particular line in cpp?
>
> I tried
> (gdb) break HTMLParser.cpp:208
That *is* the correct way.
> But I get:
> No symbol table is loaded. ?Use the "file" command.
Yes, do that!
In order to set a breakpoint, GDB needs to know the address of the
first instruction on the given line. To find that address, GDB needs
to have an executable file compiled with debugging info (usually the
'-g' compiler switch). You *must* provide that executable file, or GDB
will not be able to set the breakpoint.
The usual way to provide such file:
gdb /path/to/executable
Alternatively:
gdb
(gdb) file /path/to/executable
Hope this helps.
Cheers,
--
Paul Pluzhnikov