Re: Sending signal to inferior

Carlos Eduardo Rodrigues de Almeida
2005-12-30T04:29:24Z

The problem is when the inferior is running... I'll try to explain better

My program:

[eduardo@~/echo]$./echo
GNU gdb 6.3
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 "x86_64-pc-linux-gnu".
(gdb) file ../lab3/Debug/lab3
Reading symbols from /home/eduardo/lab3/Debug/lab3...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /home/eduardo/lab3/Debug/lab3
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 6959)]

Now the program is running and displaying a window

on another terminal
ps -A

(partial ps...)
6958 ? 00:00:00 gdb
6959 ? 00:00:01 lab3
6964 pts/1 00:00:00 bash
6968 pts/1 00:00:00 ps
kill -2 6958

nothing happens on my program

using tgdb_driver:

[eduardo@~/Downloads/cgdb-0.5.3/tgdb/tgdb-base/src]$./tgdb_driver
\x19GNU gdb 6.3
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 "x86_64-pc-linux-gnu".
(tgdb) \x19file /home/eduardo/lab3/Debug/lab3
Reading symbols from /home/eduardo/lab3/Debug/lab3...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(tgdb) run
Starting program: /home/eduardo/lab3/Debug/lab3
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 6950)]

on another terminal:
ps -A

(partial ps..)
6947 pts/1 00:00:00 tgdb_driver
6948 pts/3 00:00:00 tgdb_driver
6949 pts/1 00:00:00 gdb
6950 ? 00:00:01 lab3
6953 pts/2 00:00:00 ps
kill -2 6949

and on the tgdb_driver terminal:

Program received signal SIGINT, Interrupt.
[Switching to Thread 16384 (LWP 6950)]
0x00002aaaabf39084 in poll () from /lib/libc.so.6
(tgdb)

I can't make the program receive the sigint, interrupt itself and the
control return to GDB

Thank you for the answer

Eduardo

On 12/30/05, Bob Rossi <bob@brasko.net> wrote:
> > I couldn't find what tgdb does to stop the inferior when I send gdb
> > the SIGINT.. does someone can point me a solution?
>
> Hi Eduardo,
>
> I don't understand. If I compile and run your program on a sample
> inferior, tgdb_driver and your driver act the same. What is the exact
> difference you are seeing?
>
> With your driver:
> $ ./driver ./test
> GNU gdb 6.3-debian
> 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 "i386-linux".
> (gdb) No symbol table is loaded. Use the "file" command.
> file ./test
> Reading symbols from /home/bob/cvs/cgdb/cgdb/builddir/tgdb/tgdb-base/src/tmp/test...done.
> Using host libthread_db library "/lib/libthread_db.so.1".
> (gdb) (gdb) Quit
>
> With tgdb_driver:
>
> $ ./tgdb_driver ./test
> GNU gdb 6.3-debian
> 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 "i386-linux"...No symbol table is loaded. Use the "file" command.
> Using host libthread_db library "/lib/libthread_db.so.1".
>
> (tgdb) Quit
> (tgdb)
>
> In both cases, I ran
> $ kill -s INT PID
>
> This is tested on a Debian box, with GDB GNU gdb 6.3-debian.
>
> Bob Rossi
>