public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* siginfo and core files
@ 2012-05-25 13:53 jmf list
  2012-05-25 14:22 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: jmf list @ 2012-05-25 13:53 UTC (permalink / raw)
  To: gdb

Hello,

Is it possible to access the si_addr and si_signo siginfo fields from
a core dump in GDB? When debugging a live process I access these
values via the $_siginfo convenience var. I am not sure if both of
these values are normally stored in a core dump, or if they are
accessible via GDB.

I noticed that the signal number is printed to the console when I load
a core file, so I started reading the GDB source around the string
"Program terminated with signal" and found that the signal number is
read from the core file via gdb/corelow.c::core_open and
bfd/corefile.c::bfd_core_fail_failing_signal. It isn't apparent to me
that any of the other siginfo is stored or read, however.

I would like to access these values via the GDB Python API for both
live processes and core files. As it stands, I could potentially parse
'info target' to determine the target type, and respectively use
"$_siginfo" to get both si_signo and si_addr if my script is running
on a live process, or use "target core <corefile>" to get just the
signal number (and let the tool degrade gracefully for lack of
si_addr) if my script is running on a core file. That solution is a
bit of a kludge though, and I would like to access si_addr in the core
file if possible.

I am running GDB 7.4 in FC16 on x86_64 for this analysis.

Thanks. Any help would be appreciated,
J

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: siginfo and core files
  2012-05-25 13:53 siginfo and core files jmf list
@ 2012-05-25 14:22 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2012-05-25 14:22 UTC (permalink / raw)
  To: jmf list; +Cc: gdb

On 05/25/2012 02:53 PM, jmf list wrote:

> Is it possible to access the si_addr and si_signo siginfo fields from
> a core dump in GDB?

> When debugging a live process I access these

> values via the $_siginfo convenience var. I am not sure if both of
> these values are normally stored in a core dump, or if they are
> accessible via GDB.


I don't think the whole siginfo object is stored on core files.

See /usr/include/linux/elfcore.h .  The elf_prstatus and elf_prpsinfo
structures is what is put in the core.   We can retrieve some info, but
unfortunately, it doesn't look like si_addr is anywhere to be found.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-25 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-25 13:53 siginfo and core files jmf list
2012-05-25 14:22 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).