* How do you debug gdb?
@ 2008-02-18 5:08 Ray Hurst
2008-02-18 8:54 ` Fabian Cenedese
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ray Hurst @ 2008-02-18 5:08 UTC (permalink / raw)
To: gdb
It seemed that this question was better suited for the development group
than in the general group.
How do you debug gdb?
In other words, if I have a problem with gdb itself how do I go about
debugging the issue?
Ray
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do you debug gdb?
2008-02-18 5:08 How do you debug gdb? Ray Hurst
@ 2008-02-18 8:54 ` Fabian Cenedese
2008-02-18 9:04 ` Gerrit van Niekerk
2008-02-19 20:19 ` Michael Snyder
2 siblings, 0 replies; 5+ messages in thread
From: Fabian Cenedese @ 2008-02-18 8:54 UTC (permalink / raw)
To: gdb
At 20:00 17.02.2008 -0800, Ray Hurst wrote:
>It seemed that this question was better suited for the development group than in the general group.
>
>How do you debug gdb?
>
>In other words, if I have a problem with gdb itself how do I go about debugging the issue?
You should be able to do it the same as with every other program:
load gdb in gdb and then load some other program in the gdb being
debugged. To debug gdb it should contain the debug symbols.
bye Fabi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do you debug gdb?
2008-02-18 5:08 How do you debug gdb? Ray Hurst
2008-02-18 8:54 ` Fabian Cenedese
@ 2008-02-18 9:04 ` Gerrit van Niekerk
2008-02-19 20:19 ` Michael Snyder
2 siblings, 0 replies; 5+ messages in thread
From: Gerrit van Niekerk @ 2008-02-18 9:04 UTC (permalink / raw)
To: gdb
On 17 Feb 2008 at 20:00, Ray Hurst wrote:
> It seemed that this question was better suited for the development group
> than in the general group.
>
> How do you debug gdb?
>
> In other words, if I have a problem with gdb itself how do I go about
> debugging the issue?
>
You first have to build GDB with symbols, so you run "config" and then
"make".
If you debug gdb right in the directory it was created, you automatically get a
script loaded which will differentiate between a breakpoint being hit in gdb
and in the debug target.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do you debug gdb?
2008-02-18 5:08 How do you debug gdb? Ray Hurst
2008-02-18 8:54 ` Fabian Cenedese
2008-02-18 9:04 ` Gerrit van Niekerk
@ 2008-02-19 20:19 ` Michael Snyder
2008-02-19 21:50 ` Doug Evans
2 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2008-02-19 20:19 UTC (permalink / raw)
To: Ray Hurst; +Cc: gdb
On Sun, 2008-02-17 at 20:00 -0800, Ray Hurst wrote:
> It seemed that this question was better suited for the development group
> than in the general group.
>
> How do you debug gdb?
>
> In other words, if I have a problem with gdb itself how do I go about
> debugging the issue?
It's a little counter intuitive, but just as you compile GCC
with GCC, you also debug GDB with GDB.
After all, GDB is just a program...
If you do it in the build directory, you will find that
there is already some infrastructure in place. See the
existing file ".gdbinit", which sets some breakpoints
and changes the prompt.
Changing the prompt is perhaps the number one
most important thing to do --- that way you can
tell by looking at the prompt whether you are
talking to the gdb-being-debugged or to the
gdb-doing-the-debugging.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do you debug gdb?
2008-02-19 20:19 ` Michael Snyder
@ 2008-02-19 21:50 ` Doug Evans
0 siblings, 0 replies; 5+ messages in thread
From: Doug Evans @ 2008-02-19 21:50 UTC (permalink / raw)
To: Michael Snyder; +Cc: Ray Hurst, gdb
On Feb 19, 2008 11:38 AM, Michael Snyder <msnyder@specifix.com> wrote:
>
> On Sun, 2008-02-17 at 20:00 -0800, Ray Hurst wrote:
> > It seemed that this question was better suited for the development group
> > than in the general group.
> >
> > How do you debug gdb?
> >
> > In other words, if I have a problem with gdb itself how do I go about
> > debugging the issue?
>
> It's a little counter intuitive, but just as you compile GCC
> with GCC, you also debug GDB with GDB.
>
> After all, GDB is just a program...
>
> If you do it in the build directory, you will find that
> there is already some infrastructure in place. See the
> existing file ".gdbinit", which sets some breakpoints
> and changes the prompt.
>
> Changing the prompt is perhaps the number one
> most important thing to do --- that way you can
> tell by looking at the prompt whether you are
> talking to the gdb-being-debugged or to the
> gdb-doing-the-debugging.
A couple more things that mighn't be immediately clear.
If you're in the child gdb (the prompt is "(gdb) ") and you want to
get to the parent gdb, and you're using .gdbinit in the build
directory, then you just type "i". To get back to the child gdb,
continue. As in
(gdb) i
(top-gdb) c
(gdb)
Another useful thing is to rebuild gdb with -O0 if not done already.
bash$ cd obj/gdb
bash$ make clean
bash$ make CFLAGS=-g
bash$ gdb ./gdb
[...]
(top-gdb)
Generally there's no need to debug bfd/etc. but one could rebuild
those too as necessary.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-19 21:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-18 5:08 How do you debug gdb? Ray Hurst
2008-02-18 8:54 ` Fabian Cenedese
2008-02-18 9:04 ` Gerrit van Niekerk
2008-02-19 20:19 ` Michael Snyder
2008-02-19 21:50 ` Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox