diff options
author | Anton Kolesov <Anton.Kolesov@synopsys.com> | 2013-09-12 15:56:45 +0400 |
---|---|---|
committer | Claudiu Zissulescu <claziss@synopsys.com> | 2016-08-24 13:56:32 +0200 |
commit | 47f7f636bc8abc3c41848a412a68ca6aa36dbd21 (patch) | |
tree | 951140659113804ea74888a8aca4606e143fb8c5 | |
parent | 1130c90ed7c8d1bc7b70c701b62cdbc23ac9fc01 (diff) | |
download | gdb-47f7f636bc8abc3c41848a412a68ca6aa36dbd21.zip gdb-47f7f636bc8abc3c41848a412a68ca6aa36dbd21.tar.gz gdb-47f7f636bc8abc3c41848a412a68ca6aa36dbd21.tar.bz2 |
[ARC] Parse NOTE section in core dump files
This patch adds function elf32_arc_grok_parse to parse NOTE section of core
dump files. GDB requires this to work properly with core dumps.
bfd/
2016-08-24 Anton Kolesov <Anton.Kolesov@synopsys.com>
* elf32-arc.c (elf32_arc_grok_prstatus): New function.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
-rw-r--r-- | bfd/ChangeLog | 4 | ||||
-rw-r--r-- | bfd/elf32-arc.c | 35 |
2 files changed, 39 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 84fceea..529a3b5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2016-08-24 Anton Kolesov <Anton.Kolesov@synopsys.com> + + * elf32-arc.c (elf32_arc_grok_prstatus): New function. + 2016-08-23 Nick Clifton <nickc@redhat.com> * elf32-arm.c (elf32_arm_count_additional_relocs): Return zero if diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index 00828be..89a2b52 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -2439,6 +2439,39 @@ elf_arc_add_symbol_hook (bfd * abfd, return TRUE; } +/* GDB expects general purpose registers to be in section .reg. However Linux + kernel doesn't create this section and instead writes registers to NOTE + section. It is up to the binutils to create a pseudo-section .reg from the + contents of NOTE. Also BFD will read pid and signal number from NOTE. This + function relies on offsets inside elf_prstatus structure in Linux to be + stable. */ + +static bfd_boolean +elf32_arc_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + int offset; + size_t size; + + switch (note->descsz) + { + default: + return FALSE; + + case 236: /* sizeof (struct elf_prstatus) on Linux/arc. */ + /* pr_cursig */ + elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); + /* pr_pid */ + elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24); + /* pr_regs */ + offset = 72; + size = (40 * 4); /* There are 40 registers in user_regs_struct. */ + break; + } + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", size, + note->descpos + offset); +} + #define TARGET_LITTLE_SYM arc_elf32_le_vec #define TARGET_LITTLE_NAME "elf32-littlearc" #define TARGET_BIG_SYM arc_elf32_be_vec @@ -2484,6 +2517,8 @@ elf_arc_add_symbol_hook (bfd * abfd, #define elf_backend_may_use_rela_p 1 #define elf_backend_default_use_rela_p 1 +#define elf_backend_grok_prstatus elf32_arc_grok_prstatus + #define elf_backend_default_execstack 0 #include "elf32-target.h" |