From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9564 invoked by alias); 14 Jun 2013 07:49:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 9552 invoked by uid 89); 14 Jun 2013 07:49:06 -0000 X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 14 Jun 2013 07:49:04 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id r5E7mwT6013776; Fri, 14 Jun 2013 09:48:58 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id r5E7mwK3012271; Fri, 14 Jun 2013 09:48:58 +0200 (CEST) Date: Fri, 14 Jun 2013 08:59:00 -0000 Message-Id: <201306140748.r5E7mwK3012271@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: sergiodj@redhat.com CC: gdb-patches@sourceware.org In-reply-to: (message from Sergio Durigan Junior on Thu, 13 Jun 2013 21:37:59 -0300) Subject: Re: [RFC/PATCH] Add new internal variable $_signo References: X-SW-Source: 2013-06/txt/msg00325.txt.bz2 > From: Sergio Durigan Junior > Date: Thu, 13 Jun 2013 21:37:59 -0300 > > Hi, > > This patch comes from a request at: > > > > Basically, the ABRT project () wants > to be able to perform some analysis on corefiles (to be implemented as a > Python GDB module) and for that it needs to be able to inspect the > signal which killed the program being investigated. > > This can be done with recent Linux kernels by inspecting the $_siginfo > convenience variable (on corefiles, it works by parsing the contents of > the NT_SIGINFO section, whose support was added by Tom on > 1b05b77b857f26c59ad5dc6443fc8baa21696440). The NT_SIGINFO section was > added on the kernel by: > > author Denys Vlasenko 2012-10-05 00:15:35 (GMT) > commit 49ae4d4b113be03dc4a2ec5f2a1f573ff0fcddb3 (patch) > > (This is Linux 3.7-rc1). > > Well, the problem is that for older kernels (or not so old, as can be > noted by the date), when one tries to access $_siginfo.si_signo from a > corefile he/she gets: > > (gdb) core ./coredump > [New LWP 2703] > Core was generated by `/usr/bin/gnote <>'. > Program terminated with signal 11, Segmentation fault. > #0 0x09fa5348 in ?? () > (gdb) print $_siginfo.si_signo > Unable to read siginfo > > The signal can obviously be recovered because GDB itself mentioned it > when saying that it was "signal 11, Segmentation fault", and this is why > this patch came to life. It basically sets/creates a new internal > variable called "$_signo" to be used as an alternative to > $_siginfo.si_signo when this one is unavailable. It's not a complex > patch per se, but I would certainly like some review because there may > be other places where we should set the variable as well. > > The patch also contains a testcase and an update to the documentation in > order to mention the new convenience variable. > > Comments? OK to apply? Sounds reasonable to me. Implementation seems sound. > gdb/ChangeLog: > 2013-06-13 Denys Vlasenko > > * corelow.c (core_open): Set internal variable "$_signo". > * infrun.c (handle_inferior_event): Likewise, for > TARGET_WAITKIND_SIGNALLED and TARGET_WAITKIND_STOPPED. > > gdb/testsuite/ChangeLog: > 2013-06-13 Sergio Durigan Junior > > * gdb.base/signo.c: New file. > * gdb.base/signo.exp: Likewise. > > gdb/doc/ChangeLog: > 2013-06-13 Sergio Durigan Junior > > * gdb.texinfo (Convenience Variables): Document "$_signo".