This is the mail archive of the
mailing list for the GDB project.
Re: Sending signal to inferior program.
On Mon, 06 Jun 2011 22:25:16 +0200, logitech wrote:
> the same thing as forking a thread from gdb
BTW GDB is not thread safe so the forked thread must not modify anything of
GDB, that is it is easier to just fork() from GDB, which is mostly the same as
running a completely separate program - for example by the GDB `shell'
> Instead of CTRL-C, I want the signal to be sent from gdb to the prog. I want
> to actually break the execution of the program at a specific time, so to
> send the signal to the program at say 100ms.
Maybe like this way?
cat >x <<EOH
set target-async on
set non-stop on
set pagination off
run 1h &
shell date --iso=seconds; sleep 1s; date --iso=seconds
gdb -x ./x
GNU gdb (GDB) 18.104.22.16810605-cvs
Copyright (C) 2011 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
Id Target Id Frame
* 1 process 6427 "sleep" (running)
[process 6427] #1 stopped.
0x00007ffff7aeccd0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:82
82 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
#0 0x00007ffff7aeccd0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:82
#1 0x0000000000403c58 in rpl_nanosleep (requested_delay=0x7fffffffdc20, remaining_delay=0x0) at nanosleep.c:93
#2 0x00000000004032c5 in xnanosleep (seconds=<optimized out>) at xnanosleep.c:111
#3 0x0000000000401416 in main (argc=<optimized out>, argv=<optimized out>) at sleep.c:147
(gdb) info threads
Id Target Id Frame
* 1 process 6427 "sleep" 0x00007ffff7aeccd0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:82
If one runs that break-in-1sec directly from the ./x script it does not work, I
have filed for it: