RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 971849 - Add $_signo convenience variable
Summary: Add $_signo convenience variable
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gdb
Version: 6.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Sergio Durigan Junior
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-07 12:14 UTC by Denys Vlasenko
Modified: 2014-10-14 07:27 UTC (History)
5 users (show)

Fixed In Version: gdb-7.2-66.el6
Doc Type: Enhancement
Doc Text:
Cause: GDB did not had a proper way of representing the signal that caused the program being debugged to exit. Consequence: There was no way to retrieve this information when using a corefile for debugging. Fix: GDB now correctly exports the signal that caused the program being debugged to exit. Result: The user can now obtain this information when using a corefile for debugging.
Clone Of:
Environment:
Last Closed: 2014-10-14 07:27:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (untested) (2.12 KB, patch)
2013-06-07 13:23 UTC, Denys Vlasenko
no flags Details | Diff
Updated patch. (1.76 KB, patch)
2013-06-11 15:59 UTC, Denys Vlasenko
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1534 0 normal SHIPPED_LIVE gdb bug fix and enhancement update 2014-10-14 01:21:50 UTC

Description Denys Vlasenko 2013-06-07 12:14:44 UTC
Abrt project wants to perform vulnerability analysis on saved coredumps.
It is planned to be implemented as a python gdb module.
A part of analysis requires knowing the signal which killed the task.

This works on a live process:

sig = gdb.parse_and_eval("$_siginfo.si_signo")

but not on the coredump:

(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

But obviously, gdb does know the signal number - it even said so a few lines above.

Please add a convenience variable for it. Say, call it $_signo.

Comment 1 Jan Kratochvil 2013-06-07 12:23:20 UTC
GDB can decode full $_siginfo from NT_SIGINFO; I did not test it but assuming RHEL-6 kernel still did not produce NT_SIGINFO.

As it is just a backward compatibility issue isn't it enough to use:
eu-readelf -n ~/t/sleep.core | grep info.si_
    info.si_signo: 11, info.si_code: 0, info.si_errno: 0, cursig: 11

Comment 2 Denys Vlasenko 2013-06-07 13:23:07 UTC
Created attachment 758156 [details]
Proposed patch (untested)

Comment 3 Denys Vlasenko 2013-06-07 13:31:53 UTC
(In reply to Jan Kratochvil from comment #1)
> GDB can decode full $_siginfo from NT_SIGINFO; I did not test it but
> assuming RHEL-6 kernel still did not produce NT_SIGINFO.

Yes, I want to get at signo even on older kernels.

> As it is just a backward compatibility issue isn't it enough to use:
> eu-readelf -n ~/t/sleep.core | grep info.si_
>     info.si_signo: 11, info.si_code: 0, info.si_errno: 0, cursig: 11

Python gdb plugin wouldn't know whether it is being run on a coredump or a live process which has crashed just now.
How do you imagine to implement this in a not-horrifyingly hackish way?
I really don't want to do something like:

    try:
        sig = gdb.parse_and_eval("$_siginfo.si_signo")
    except gdb.error:
        # Hmm, we are probably working on coredump....
        # ... lets see whether we are running from the abrt and it provided us with signal number...
        try:
            sig = int(os.environ["ABRT_SIGNO_OF_THE_COREDUMP")
        except:
             ...

with corresponding code elsewhere which sets $ABRT_SIGNO_OF_THE_COREDUMP.

Comment 4 Denys Vlasenko 2013-06-11 15:59:10 UTC
Created attachment 759707 [details]
Updated patch.

I built modified gdb-7.5.1-39.fc18 with this patch, it works for me.

Comment 5 Sergio Durigan Junior 2013-06-14 18:00:35 UTC
Proposed upstream patch: http://sourceware.org/ml/gdb-patches/2013-06/msg00321.html

Comment 7 Sergio Durigan Junior 2013-10-14 00:07:16 UTC
Oh, just in case it wasn't clear: the name of the convenience variable accepted upstream has been changed from $_signo (as proposed in this bug report) to $_exitsignal.

Comment 13 errata-xmlrpc 2014-10-14 07:27:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1534.html


Note You need to log in before you can comment on or make changes to this bug.