From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: logitech <supriya.rao17@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Sending signal to inferior program.
Date: Mon, 06 Jun 2011 21:03:00 -0000 [thread overview]
Message-ID: <20110606210315.GA6325@host1.jankratochvil.net> (raw)
In-Reply-To: <31786813.post@talk.nabble.com>
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'
command.
> 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
file sleep
run 1h &
define break-in-1sec
shell date --iso=seconds; sleep 1s; date --iso=seconds
interrupt
end
info threads
EOH
gdb -x ./x
GNU gdb (GDB) 7.3.50.20110605-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:
<http://www.gnu.org/software/gdb/bugs/>.
Id Target Id Frame
* 1 process 6427 "sleep" (running)
(gdb) break-in-1sec
2011-06-06T23:01:03+0200
2011-06-06T23:01:04+0200
(gdb)
[process 6427] #1 stopped.
0x00007ffff7aeccd0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:82
82 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
bt
#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
(gdb) _
If one runs that break-in-1sec directly from the ./x script it does not work, I
have filed for it:
http://sourceware.org/bugzilla/show_bug.cgi?id=12850
Regards,
Jan
prev parent reply other threads:[~2011-06-06 21:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 17:32 logitech
2011-06-06 18:18 ` Jan Kratochvil
2011-06-06 20:25 ` logitech
2011-06-06 21:03 ` Jan Kratochvil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110606210315.GA6325@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb@sourceware.org \
--cc=supriya.rao17@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox