public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: How do you use GDB to debug GDB
@ 2001-03-21 15:59 Michael Elizabeth Chastain
  2001-03-21 15:59 ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Elizabeth Chastain @ 2001-03-21 15:59 UTC (permalink / raw)
  To: chastain, eliz; +Cc: gdb, ischis2

Eli Zaretskii writes:

> I think this is important enough to go into the manual.

I'm up for writing a manual section on "debugging gdb with gdb".
It's a good task for my Sunday Project.

I just added a yellow sticky to my monitor to that effect.

Michael

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 How do you use GDB to debug GDB Michael Elizabeth Chastain
@ 2001-03-21 15:59 ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb, ischis2

On Tue, 20 Mar 2001, Michael Elizabeth Chastain wrote:

> Eli Zaretskii writes:
> 
> > I think this is important enough to go into the manual.
> 
> I'm up for writing a manual section on "debugging gdb with gdb".
> It's a good task for my Sunday Project.

Thanks!

> I just added a yellow sticky to my monitor to that effect.

Note that there's already such a section in gdbint.texinfo (but it 
doesn't tell much).  I just asked if somebody knew of any reason not to 
move that into gdb.texinfo.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59   ` Andrew Cagney
@ 2001-03-21 15:59     ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Michael Elizabeth Chastain, gdb, ischis2

On Tue, 20 Mar 2001, Andrew Cagney wrote:

> > One thing puzzles me, though: why is the section "Debugging GDB with
> > itself" in gdbint.texinfo instead of gdb.texinfo?  Is there any reason
> > not to move (or copy) it to gdb.texinfo?  Can some of the elders
> > please shed some light on this?
> 
> To expand a little on Michael's comment.
> 
> gdbint.texinfo is for internals - the things you see when you lift the
> bonnet (1) and start poking around with the engine.

Exactly.  And, at least in my opinion, a collection of user-level
tricks useful for debugging a specific program called `gdb' is not
exactly ``what you see under the hood''.

> As a complete asside, it has also been suggested that the two documents
> be merged.  From memory GCC did this.

How about if we do that for 5.1?  Shouldn't be too hard, I think.

OTOH, the GCC manual leaves a lot to be desired (IMHO), so perhaps we
shouldn't follow their lead without thinking real hard.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59   ` Frank Ch. Eigler
@ 2001-03-21 15:59     ` Christopher Faylor
  0 siblings, 0 replies; 16+ messages in thread
From: Christopher Faylor @ 2001-03-21 15:59 UTC (permalink / raw)
  To: GDB

On Mon, Mar 19, 2001 at 05:44:12PM -0500, Frank Ch. Eigler wrote:
>Fernando Nasser <fnasser@cygnus.com> writes:
>: [...]
>: Start your "top" gdb in a separate shell.  Use the command attach passing the Windows 
>: PID (as opposed to the Unix PID) of the other GDB.
>: [...]
>
>By the way, why does cygwin gdb use Windows PIDs only instead of
>cygwin PIDs, or some fall-back defaulting from one to the other?

GDB uses Windows pids because it can debug more than just cygwin
applications.  In older DLLs it was possible to have the same number
indicate both a Windows PID and a Cygwin PID, so there was ambiguity.
You don't want to have a mechanism which disallows the ability to
debug a program or ends up debugging the wrong program.

In current net releases of Cygwin it is (or should be) impossible
to have the cygwin pid == the windows pid except for when they
are the same process.

So, I guess you could have a fallback mechanism if somebody wanted
to implement it.

cgf

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
@ 2001-03-21 15:59 Michael Elizabeth Chastain
  2001-03-21 15:59 ` Stephen Smith
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Michael Elizabeth Chastain @ 2001-03-21 15:59 UTC (permalink / raw)
  To: gdb, ischis2

Hello Stephen,

This is how I do it:

  % gdb powerpc-motorola-elf-gdb
  (gdb) set prompt [top] 
  [top] set args --command=C:/rti/bin/rtidbug.ini C:/examples/dll/main.exe
  [top] break help_command
  [top] run

The first command helps me keep track of which gdb I'm in.  There is
a space at the end of the command: "set prompt [top] ".

The second command tells the superior gdb what the arguments are for
the inferior gdb.  This is the heart of what you want.  Note that you
can re-run the inferior gdb and the arguments will repeat.

The third line sets a convenient breakpoint in the superior gdb so that
you can bounce back up to it.  I usually do "help foo" instead of "help"
for getting to the superior gdb, to reduce the screen output.

The fourth line starts the inferior gdb with the arguments given on the
second line.

I've done this on both Unix/Linux and Cygwin gdb's.

Cheers,

Michael Elizabeth Chastain
<chastain@redhat.com>
"love without fear"

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
@ 2001-03-21 15:59 Michael Elizabeth Chastain
  2001-03-21 15:59 ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Elizabeth Chastain @ 2001-03-21 15:59 UTC (permalink / raw)
  To: chastain, eliz; +Cc: gdb, ischis2

Hi Eli,

> Note that there's already such a section in gdbint.texinfo (but it 
> doesn't tell much).

Okay, I see it.  I'll be expanding that section.

> I just asked if somebody knew of any reason not to 
> move that into gdb.texinfo.

Mmmm, that is a separate issue.

gdbint.texinfo is the right file for people who are working on gdb.
Someone running gdb on another copy of gdb is working on gdb.
So I'm in favor of leaving this section in gdbint.texinfo.

Michael

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 ` Eli Zaretskii
  2001-03-21 15:59   ` Andrew Cagney
@ 2001-03-21 15:59   ` Kevin Buettner
  1 sibling, 0 replies; 16+ messages in thread
From: Kevin Buettner @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Eli Zaretskii, Michael Elizabeth Chastain; +Cc: gdb, ischis2

On Mar 20, 11:17am, Eli Zaretskii wrote:

> One thing puzzles me, though: why is the section "Debugging GDB with
> itself" in gdbint.texinfo instead of gdb.texinfo?  Is there any reason
> not to move (or copy) it to gdb.texinfo?

Presumably there's little reason for the average user to want to
debug GDB (with itself).  Therefore it's more suitable for such
material to appear in the internals document...

Kevin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 Michael Elizabeth Chastain
  2001-03-21 15:59 ` Stephen Smith
  2001-03-21 15:59 ` Eli Zaretskii
@ 2001-03-21 15:59 ` Stephen Smith
  2 siblings, 0 replies; 16+ messages in thread
From: Stephen Smith @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb

Michael Elizabeth Chastain wrote:

> Hello Stephen,
>
> This is how I do it:
>
>   [top] break help_command
>   [top] run
>
> The third line sets a convenient breakpoint in the superior gdb so that
> you can bounce back up to it.  I usually do "help foo" instead of "help"
> for getting to the superior gdb, to reduce the screen output.
>

Ok, so how do I active "help_command"

It doesn't appear to be by accessing help

sps

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 Stephen Smith
@ 2001-03-21 15:59 ` Fernando Nasser
  2001-03-21 15:59   ` Frank Ch. Eigler
  2001-03-21 15:59 ` J.T. Conklin
  1 sibling, 1 reply; 16+ messages in thread
From: Fernando Nasser @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Stephen Smith; +Cc: GDB

Stephen Smith wrote:
> 
> I have a gdb debugger configured to for a remote target (host i686-pc-cygwin target=powerpc-motorola-elf).  normally I
> run gdb as:
> 
>      powerpc-motorola-elf-gdb --command=C:/rti/bin/rtidbug.ini C:/examples/dll/main.exe
> 
> Now I want to run the gdb against the above process.  Since I am running this in a Windows NT command shell I can't use
>     gdb   /usr/local/bin/powerpc-motorola-elf-gdb  some_process_id
> 
> Can someone help
> 

Use the "ps -l" command.  It will give you the Windows PID in addition to the Unix (Cygwin) one.


Start your "top" gdb in a separate shell.  Use the command attach passing the Windows PID (as opposed to the Unix PID) of the other GDB.

You are now debugging your powerpc-motorola-elf-gdb


Good luck.





-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 Stephen Smith
  2001-03-21 15:59 ` Fernando Nasser
@ 2001-03-21 15:59 ` J.T. Conklin
  1 sibling, 0 replies; 16+ messages in thread
From: J.T. Conklin @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Stephen Smith; +Cc: GDB

>>>>> "Stephen" == Stephen Smith <ischis2@home.com> writes:
Stephen> I have a gdb debugger configured to for a remote target (host
Stephen> i686-pc-cygwin target=powerpc-motorola-elf).  normally I run
Stephen> gdb as:
Stephen>
Stephen>      powerpc-motorola-elf-gdb --command=C:/rti/bin/rtidbug.ini C:/examples/dll/main.exe
Stephen>
Stephen> Now I want to run the gdb against the above process.  

On a UNIX system, you would first start a native GDB, and then use it
to run and debug the child GDB.

        $ gdb /usr/local/bin/powerpc-motorola-elf-gdb
        GDB is free software and you are ...
        (gdb)

At this point, I typically install breakpoints where I think there the
problem lies.  The .gdbinit file distributed with GDB sets breakpoints
and sets directory paths, etc.; thus creating an initial environment
that are likely to be useful debugging GDB.

Then run your child GDB.

        (gdb) run --command=C:/rti/bin/rtidbug.ini C:/examples/dll/main.exe

I don't have experience with NT to know whether this will work there.

        --jtc

-- 
J.T. Conklin
RedBack Networks

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 Michael Elizabeth Chastain
  2001-03-21 15:59 ` Stephen Smith
@ 2001-03-21 15:59 ` Eli Zaretskii
  2001-03-21 15:59   ` Andrew Cagney
  2001-03-21 15:59   ` Kevin Buettner
  2001-03-21 15:59 ` Stephen Smith
  2 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb, ischis2

On Mon, 19 Mar 2001, Michael Elizabeth Chastain wrote:

>   % gdb powerpc-motorola-elf-gdb
>   (gdb) set prompt [top] 
>   [top] set args --command=C:/rti/bin/rtidbug.ini C:/examples/dll/main.exe
>   [top] break help_command
>   [top] run
> 
> The first command helps me keep track of which gdb I'm in.  There is
> a space at the end of the command: "set prompt [top] ".
> 
> The second command tells the superior gdb what the arguments are for
> the inferior gdb.  This is the heart of what you want.  Note that you
> can re-run the inferior gdb and the arguments will repeat.
> 
> The third line sets a convenient breakpoint in the superior gdb so that
> you can bounce back up to it.  I usually do "help foo" instead of "help"
> for getting to the superior gdb, to reduce the screen output.
> 
> The fourth line starts the inferior gdb with the arguments given on the
> second line.

I think this is important enough to go into the manual.

If anyone has additional tricks pertginent to debugging GDB, please
post them, and I will merge them all together.

One thing puzzles me, though: why is the section "Debugging GDB with
itself" in gdbint.texinfo instead of gdb.texinfo?  Is there any reason
not to move (or copy) it to gdb.texinfo?  Can some of the elders
please shed some light on this?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 Michael Elizabeth Chastain
@ 2001-03-21 15:59 ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: chastain, gdb, ischis2

On Tue, 20 Mar 2001, Michael Elizabeth Chastain wrote:

> > I just asked if somebody knew of any reason not to 
> > move that into gdb.texinfo.
> 
> Mmmm, that is a separate issue.

Yes.

> gdbint.texinfo is the right file for people who are working on gdb.
> Someone running gdb on another copy of gdb is working on gdb.
> So I'm in favor of leaving this section in gdbint.texinfo.

Thanks for the feedback.  In any case, please modify the section in 
gdbint.texinfo; any administrivia such as moving it to another place can 
then be done separately.

Thanks again!

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 ` Fernando Nasser
@ 2001-03-21 15:59   ` Frank Ch. Eigler
  2001-03-21 15:59     ` Christopher Faylor
  0 siblings, 1 reply; 16+ messages in thread
From: Frank Ch. Eigler @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: Stephen Smith, GDB

Fernando Nasser <fnasser@cygnus.com> writes:

: [...]
: Start your "top" gdb in a separate shell.  Use the command attach passing the Windows 
: PID (as opposed to the Unix PID) of the other GDB.
: [...]

By the way, why does cygwin gdb use Windows PIDs only instead of
cygwin PIDs, or some fall-back defaulting from one to the other?


- FChE

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 ` Eli Zaretskii
@ 2001-03-21 15:59   ` Andrew Cagney
  2001-03-21 15:59     ` Eli Zaretskii
  2001-03-21 15:59   ` Kevin Buettner
  1 sibling, 1 reply; 16+ messages in thread
From: Andrew Cagney @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Elizabeth Chastain, gdb, ischis2

> One thing puzzles me, though: why is the section "Debugging GDB with
> itself" in gdbint.texinfo instead of gdb.texinfo?  Is there any reason
> not to move (or copy) it to gdb.texinfo?  Can some of the elders
> please shed some light on this?

To expand a little on Michael's comment.

gdbint.texinfo is for internals - the things you see when you lift the
bonnet (1) and start poking around with the engine.

gdb.texinfo is for the user - the external interfaces to GDB.  If anyone
has ever wondered why the remote protocol is documented in gdb.texinfo
and not gdbint.texinfo then this is it - it is an external interface to
gdb.  To get carried away with the car metaphore, its a bit like the
section of the manual which tries to explain how it is possible to
change a flat using just the spare and tools all hidden somewhere in the
boot (2).

As a complete asside, it has also been suggested that the two documents
be merged.  From memory GCC did this.

	Andrew


(1) Hood for the geographically impaired.
(2) Trunk for the geographically impaired.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* How do you use GDB to debug GDB
@ 2001-03-21 15:59 Stephen Smith
  2001-03-21 15:59 ` Fernando Nasser
  2001-03-21 15:59 ` J.T. Conklin
  0 siblings, 2 replies; 16+ messages in thread
From: Stephen Smith @ 2001-03-21 15:59 UTC (permalink / raw)
  To: GDB

I have a gdb debugger configured to for a remote target (host i686-pc-cygwin target=powerpc-motorola-elf).  normally I
run gdb as:

     powerpc-motorola-elf-gdb --command=C:/rti/bin/rtidbug.ini C:/examples/dll/main.exe

Now I want to run the gdb against the above process.  Since I am running this in a Windows NT command shell I can't use
    gdb   /usr/local/bin/powerpc-motorola-elf-gdb  some_process_id

Can someone help

sps




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How do you use GDB to debug GDB
  2001-03-21 15:59 Michael Elizabeth Chastain
@ 2001-03-21 15:59 ` Stephen Smith
  2001-03-21 15:59 ` Eli Zaretskii
  2001-03-21 15:59 ` Stephen Smith
  2 siblings, 0 replies; 16+ messages in thread
From: Stephen Smith @ 2001-03-21 15:59 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb

I ignored the break line since I'm not sure what to do with it.  Anyway thanks.  I now will be able to work on the
shared library problem that I keep posting about.

sps

Michael Elizabeth Chastain wrote:

> Hello Stephen,
>
> This is how I do it:
>
>   % gdb powerpc-motorola-elf-gdb
>   (gdb) set prompt [top]
>   [top] set args --command=C:/rti/bin/rtidbug.ini C:/examples/dll/main.exe
>   [top] break help_command
>   [top] run
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2001-03-21 15:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-21 15:59 How do you use GDB to debug GDB Michael Elizabeth Chastain
2001-03-21 15:59 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2001-03-21 15:59 Michael Elizabeth Chastain
2001-03-21 15:59 ` Stephen Smith
2001-03-21 15:59 ` Eli Zaretskii
2001-03-21 15:59   ` Andrew Cagney
2001-03-21 15:59     ` Eli Zaretskii
2001-03-21 15:59   ` Kevin Buettner
2001-03-21 15:59 ` Stephen Smith
2001-03-21 15:59 Stephen Smith
2001-03-21 15:59 ` Fernando Nasser
2001-03-21 15:59   ` Frank Ch. Eigler
2001-03-21 15:59     ` Christopher Faylor
2001-03-21 15:59 ` J.T. Conklin
2001-03-21 15:59 Michael Elizabeth Chastain
2001-03-21 15:59 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).