public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND
@ 2018-10-29 15:21 Milian Wolff
  2018-11-04 23:04 ` Mark Wielaard
  0 siblings, 1 reply; 8+ messages in thread
From: Milian Wolff @ 2018-10-29 15:21 UTC (permalink / raw)
  To: elfutils-devel; +Cc: mark, Milian Wolff

On my system with g++ (GCC) 8.2.1 20180831 with GNU gold (GNU Binutils
2.31.1) 1.16, the .eh_frame section does not have type PROGBITS
but rather is using X86_64_UNWIND nowadays:

```
$ echo "int main(){ return 0; }" > test.c
$ gcc test.c
$ readelf --sections a.out | grep .eh_frame
  [14] .eh_frame         X86_64_UNWIND    0000000000000670  00000670
  [15] .eh_frame_hdr     X86_64_UNWIND    0000000000000724  00000724
```

Without this patch, libdw refuses to use the available unwind
information, leading to broken backtraces while unwinding. With the
patch applied, unwinding works once more in such situations.

Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
---
 libdw/dwarf_getcfi_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdw/dwarf_getcfi_elf.c b/libdw/dwarf_getcfi_elf.c
index 315cc02f..4bcfe5cd 100644
--- a/libdw/dwarf_getcfi_elf.c
+++ b/libdw/dwarf_getcfi_elf.c
@@ -298,7 +298,7 @@ getcfi_shdr (Elf *elf, const GElf_Ehdr *ehdr)
 	    }
 	  else if (!strcmp (name, ".eh_frame"))
 	    {
-	      if (shdr->sh_type == SHT_PROGBITS)
+	      if (shdr->sh_type == SHT_PROGBITS || shdr->sh_type == SHT_X86_64_UNWIND)
 		return getcfi_scn_eh_frame (elf, ehdr, scn, shdr,
 					    hdr_scn, hdr_vaddr);
 	      else
-- 
2.19.1

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

end of thread, other threads:[~2018-11-13 21:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 15:21 [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND Milian Wolff
2018-11-04 23:04 ` Mark Wielaard
2018-11-05 23:13   ` Milian Wolff
2018-11-06 11:07     ` Mark Wielaard
2018-11-07  9:03       ` Milian Wolff
2018-11-09 16:57         ` Mark Wielaard
2018-11-10 23:29           ` Mark Wielaard
2018-11-13 21:19             ` Mark Wielaard

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).