From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: sergiodj@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC/PATCH] Add new internal variable $_signo
Date: Fri, 14 Jun 2013 08:59:00 -0000 [thread overview]
Message-ID: <201306140748.r5E7mwK3012271@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <m3obb9y1aw.fsf@redhat.com> (message from Sergio Durigan Junior on Thu, 13 Jun 2013 21:37:59 -0300)
> From: Sergio Durigan Junior <sergiodj@redhat.com>
> Date: Thu, 13 Jun 2013 21:37:59 -0300
>
> Hi,
>
> This patch comes from a request at:
>
> <https://bugzilla.redhat.com/show_bug.cgi?id=971849>
>
> Basically, the ABRT project (<https://fedorahosted.org/abrt/wiki>) 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 <vda.linux@googlemail.com> 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 <<skip>>'.
> 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 <dvlasenk@redhat.com>
>
> * 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 <sergiodj@redhat.com>
>
> * gdb.base/signo.c: New file.
> * gdb.base/signo.exp: Likewise.
>
> gdb/doc/ChangeLog:
> 2013-06-13 Sergio Durigan Junior <sergiodj@redhat.com>
>
> * gdb.texinfo (Convenience Variables): Document "$_signo".
next prev parent reply other threads:[~2013-06-14 7:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-14 2:39 Sergio Durigan Junior
2013-06-14 7:49 ` Eli Zaretskii
2013-06-16 6:08 ` Sergio Durigan Junior
2013-06-14 8:59 ` Mark Kettenis [this message]
2013-06-14 9:37 ` Pierre Muller
2013-06-14 17:59 ` Sergio Durigan Junior
2013-06-14 20:36 ` Pedro Alves
2013-06-15 6:46 ` Sergio Durigan Junior
2013-06-17 17:02 ` Pedro Alves
2013-06-14 17:58 ` Pedro Alves
2013-06-16 5:57 ` Sergio Durigan Junior
2013-06-16 6:25 ` Sergio Durigan Junior
2013-06-17 17:20 ` Pedro Alves
2013-07-17 18:41 ` Tom Tromey
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=201306140748.r5E7mwK3012271@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=sergiodj@redhat.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