From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24994 invoked by alias); 28 Sep 2007 00:25:41 -0000 Received: (qmail 24970 invoked by uid 22791); 28 Sep 2007 00:25:40 -0000 X-Spam-Check-By: sourceware.org Received: from fk-out-0910.google.com (HELO fk-out-0910.google.com) (209.85.128.191) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 28 Sep 2007 00:25:37 +0000 Received: by fk-out-0910.google.com with SMTP id 26so2563694fkx for ; Thu, 27 Sep 2007 17:25:34 -0700 (PDT) Received: by 10.82.178.11 with SMTP id a11mr5938662buf.1190939133711; Thu, 27 Sep 2007 17:25:33 -0700 (PDT) Received: by 10.82.108.11 with HTTP; Thu, 27 Sep 2007 17:25:33 -0700 (PDT) Message-ID: <4dcb5abd0709271725v73cdf443q46fb43c985474c21@mail.gmail.com> Date: Fri, 28 Sep 2007 01:23:00 -0000 From: "Carl Shapiro" To: "Mark Kettenis" Subject: Re: Problems with hook-stop Cc: gdb@sourceware.org In-Reply-To: <200709271127.l8RBRMPG017896@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4dcb5abd0709260133h10aede86wb60a22094c8d9884@mail.gmail.com> <200709271127.l8RBRMPG017896@brahms.sibelius.xs4all.nl> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-09/txt/msg00237.txt.bz2 On 9/27/07, Mark Kettenis 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 #include #include 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; }