* Debugging GDB and breaking?
@ 2002-12-18 5:49 James Sampson
0 siblings, 0 replies; 5+ messages in thread
From: James Sampson @ 2002-12-18 5:49 UTC (permalink / raw)
To: GDB Archive
Hello
I'm debugging the GDB with the GDB - Not to catch a bug, but to investigate
what's going on. In that case I wan't to step through everything the GDB does
when just working with it manualy. Where I am now, I've loaded a file into the
GDB being debugged, and I want the other GDB to take over, so I can see what
happens, when the GDB actually sets a breakpoint in this small testprogram.
But when I type e.g. "break main", the control never goes back to the other
GDB, so I can't see what's going on.
Isn't there a command to issue a breakpoint at the next line of code instead
of a obsolute position (name, address)?
Or could someone tell me where to look in the source code for the functions
which places a breakpoint?.
Best Regards
James
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Debugging GDB and breaking?
@ 2002-12-18 7:23 Michael Elizabeth Chastain
2002-12-18 7:59 ` Andreas Schwab
2002-12-18 11:01 ` Grant Edwards
0 siblings, 2 replies; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2002-12-18 7:23 UTC (permalink / raw)
To: gdb, i_am_triumph
Some general hints for debugging gdb:
I start with "gdb /my/gdb/to/debug/bin/gdb". I like to use a stable gdb
for the top gdb, such as the vendor-supplied gdb or gdb 5.3. Also this
helps separate, in my mind, the top gdb from the inferior gdb.
Then I immediately:
(gdb) set prompt [top]
[top] break help_command
[top] set args /program/under/test
The first line distinguishes the top gdb from the inferior gdb.
The second line lets me get back to the top gdb from the inferior gdb.
If the inferior gdb is waiting at a prompt, I just type "help foo"
and take the breakpoint at help_command.
The third line is the normal way to provide arguments to the inferior gdb.
After that, in your specific case, you want to break at break_command
and then use "next" and "step" from there.
Hope this helps,
Michael C
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Debugging GDB and breaking?
2002-12-18 7:23 Michael Elizabeth Chastain
@ 2002-12-18 7:59 ` Andreas Schwab
2002-12-18 11:01 ` Grant Edwards
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2002-12-18 7:59 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb, i_am_triumph
Michael Elizabeth Chastain <mec@shout.net> writes:
|> Some general hints for debugging gdb:
|>
|> I start with "gdb /my/gdb/to/debug/bin/gdb". I like to use a stable gdb
|> for the top gdb, such as the vendor-supplied gdb or gdb 5.3. Also this
|> helps separate, in my mind, the top gdb from the inferior gdb.
|>
|> Then I immediately:
|>
|> (gdb) set prompt [top]
|> [top] break help_command
|> [top] set args /program/under/test
|>
|> The first line distinguishes the top gdb from the inferior gdb.
If you start gdb from the build directory you get these thing
automatically through the .gdbinit file in this directory.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Debugging GDB and breaking?
2002-12-18 7:23 Michael Elizabeth Chastain
2002-12-18 7:59 ` Andreas Schwab
@ 2002-12-18 11:01 ` Grant Edwards
1 sibling, 0 replies; 5+ messages in thread
From: Grant Edwards @ 2002-12-18 11:01 UTC (permalink / raw)
To: gdb
On Wed, Dec 18, 2002 at 09:23:30AM -0600, Michael Elizabeth Chastain wrote:
> Some general hints for debugging gdb:
>
> I start with "gdb /my/gdb/to/debug/bin/gdb". I like to use a stable gdb
> for the top gdb, such as the vendor-supplied gdb or gdb 5.3. Also this
> helps separate, in my mind, the top gdb from the inferior gdb.
>
> Then I immediately:
>
> (gdb) set prompt [top]
> [top] break help_command
> [top] set args /program/under/test
>
> The first line distinguishes the top gdb from the inferior gdb.
Running them in separate ttys prevents confusion for me:
gdb -tty=<whatever> /my/buggy/gdb
Or I use the equivalent menu item in DDD or Insight...
--
Grant Edwards
grante@visi.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Debugging GDB and breaking?
@ 2002-12-19 1:16 James Sampson
0 siblings, 0 replies; 5+ messages in thread
From: James Sampson @ 2002-12-19 1:16 UTC (permalink / raw)
To: GDB Archive
>Some general hints for debugging gdb:
Cool!
>I start with "gdb /my/gdb/to/debug/bin/gdb". I like to use a stable gdb
>for the top gdb, such as the vendor-supplied gdb or gdb 5.3. Also this
>helps separate, in my mind, the top gdb from the inferior gdb.
I didn't even know the 5.3 was out - Gonna grab that immediatly :-)
>After that, in your specific case, you want to break at break_command
>and then use "next" and "step" from there.
Ok, so the "break_command" is the first function to be called when setting a
breakpoint? :-)
>Hope this helps,
Sure did, thanks :-D
Best Regards
James
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-12-19 9:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-18 5:49 Debugging GDB and breaking? James Sampson
2002-12-18 7:23 Michael Elizabeth Chastain
2002-12-18 7:59 ` Andreas Schwab
2002-12-18 11:01 ` Grant Edwards
2002-12-19 1:16 James Sampson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox