From: "Carl Shapiro" <carl.shapiro@gmail.com>
To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
Cc: gdb@sourceware.org
Subject: Re: Problems with hook-stop
Date: Fri, 28 Sep 2007 01:23:00 -0000 [thread overview]
Message-ID: <4dcb5abd0709271725v73cdf443q46fb43c985474c21@mail.gmail.com> (raw)
In-Reply-To: <200709271127.l8RBRMPG017896@brahms.sibelius.xs4all.nl>
On 9/27/07, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> Since SIGTRAP has a very special meaning for debugging, it's probably
> unwise to play games like this.
The problem I am having is not specific to SIGTRAP. You can replace
the interrupt instruction with a kill(2), providing any signal you'd
like as an argument. The stop hook will fails execute every other
time.
Here's the hook-stop definition to use:
define hook-stop
signal SIGUSR1
end
Here's the program to run under GDB:
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
void handler(int signum) {
fprintf(stderr, "handler(signum=%d)\n", signum);
}
int main(int argc, char *argv[]) {
struct sigaction sa;
int i;
sa.sa_handler = handler;
sigaction(SIGUSR1, &sa, NULL);
for (i = 0;; ++i) {
fprintf(stderr, "i=%d\n", i);
kill(getpid(), SIGUSR1);
}
return 0;
}
next prev parent reply other threads:[~2007-09-28 0:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-26 16:06 Carl Shapiro
2007-09-27 12:06 ` Mark Kettenis
2007-09-28 1:23 ` Carl Shapiro [this message]
2007-09-29 21:44 ` Daniel Jacobowitz
2007-10-02 7:57 ` Carl Shapiro
2007-10-02 11:42 ` Daniel Jacobowitz
2007-09-27 12:35 ` Christian Thalinger
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=4dcb5abd0709271725v73cdf443q46fb43c985474c21@mail.gmail.com \
--to=carl.shapiro@gmail.com \
--cc=gdb@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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