This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: debug gdb by 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