public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* debug gdb by gdb
@ 2012-09-11  9:36 John Smith
  2012-09-11 10:15 ` naga raj
  2012-09-15  0:21 ` Doug Evans
  0 siblings, 2 replies; 3+ messages in thread
From: John Smith @ 2012-09-11  9:36 UTC (permalink / raw)
  To: gdb

hi,

   i  am  try  to  debug  gdb  by  gdb  , and  a  problem confused  me
, here it is :  how can  i send  command  to  the  debugged gdb
process  which  is  the  child  process of  top-gdb ?

  as  you know ,when I  type  command  to  the  command line , this
command will  always  be  send to top-gdb  , and  how to  send
command  to  the  child gdb  dynamicly?


thanks!

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

* Re: debug gdb by gdb
  2012-09-11  9:36 debug gdb by gdb John Smith
@ 2012-09-11 10:15 ` naga raj
  2012-09-15  0:21 ` Doug Evans
  1 sibling, 0 replies; 3+ messages in thread
From: naga raj @ 2012-09-11 10:15 UTC (permalink / raw)
  To: John Smith; +Cc: gdb

Hi John,

On Tue, Sep 11, 2012 at 3:06 PM, John Smith <horserivers@gmail.com> wrote:
> hi,
>
>    i  am  try  to  debug  gdb  by  gdb  , and  a  problem confused  me
> , here it is :  how can  i send  command  to  the  debugged gdb
> process  which  is  the  child  process of  top-gdb ?
>
>   as  you know ,when I  type  command  to  the  command line , this
> command will  always  be  send to top-gdb  , and  how to  send
> command  to  the  child gdb  dynamicly?
>
If you want to debug a gdb with gdb you can debug as below
  gdb --args child-gdb  <elf>
   once you execute this command a gdb prompt of parent will appear
where you can set break point or do any other stuff. once you set a
breakpoint then enter run command

now this time again another gdb console will come there you can
commands for client gdb


ex:
 [console]$ gdb --args mb-gdb a.out
GNU gdb 6.1.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) b microblaze_extract_return_value
Breakpoint 1 at 0x804d451: file
/gnu/mb_gnu//src/gdb/gdb/microblaze-tdep.c, line 621.
(gdb) run
Starting program: /gnu/mb_gnu/gnu/microblaze/lin/bin/mb-gdb a.out
Detaching after fork from child process 546.
GNU gdb (GDB) 7.4.50.20120403-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=microblaze-xilinx-elf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /wrk/ptx/users/nagaraju/prgs/a.out...(no
debugging symbols found)...done.
(gdb) tar remote localhost:1234
Remote debugging using localhost:1234
> thanks!

Hope this helps you
Nagaraju

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

* Re: debug gdb by gdb
  2012-09-11  9:36 debug gdb by gdb John Smith
  2012-09-11 10:15 ` naga raj
@ 2012-09-15  0:21 ` Doug Evans
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Evans @ 2012-09-15  0:21 UTC (permalink / raw)
  To: John Smith; +Cc: gdb

On Tue, Sep 11, 2012 at 2:36 AM, John Smith <horserivers@gmail.com> wrote:
> hi,
>
>    i  am  try  to  debug  gdb  by  gdb  , and  a  problem confused  me
> , here it is :  how can  i send  command  to  the  debugged gdb
> process  which  is  the  child  process of  top-gdb ?
>
>   as  you know ,when I  type  command  to  the  command line , this
> command will  always  be  send to top-gdb  , and  how to  send
> command  to  the  child gdb  dynamicly?
>
>
> thanks!

This all works rather well (depending on what you mean by "dynamically").
gdb developers do it regularly. :-)

bash$ cd $build/gdb
bash$ gdb gdb
[...]
(top-gdb) r -nx hello
[...]
(gdb) r
Starting program: /home/dje/hello
Hello.
[Inferior 1 (process 9905) exited normally]
(gdb) i
(top-gdb) c
(gdb) quit
(top-gdb) quit
bash$

Do you have something specific that is not working?

Note that above I show how to get back to top-gdb from the child gdb
without terminating the child gdb using "i" or "info" without
arguments.  See gdb-gdb.gdb for how this is done.

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

end of thread, other threads:[~2012-09-15  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-11  9:36 debug gdb by gdb John Smith
2012-09-11 10:15 ` naga raj
2012-09-15  0:21 ` Doug Evans

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).