public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Milian Wolff <milian.wolff@kdab.com>
To: elfutils-devel@sourceware.org
Cc: mark@klomp.org,	Milian Wolff <milian.wolff@kdab.com>
Subject: [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND
Date: Mon, 29 Oct 2018 15:21:00 -0000	[thread overview]
Message-ID: <20181029152126.32610-1-milian.wolff@kdab.com> (raw)

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

             reply	other threads:[~2018-10-29 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 15:21 Milian Wolff [this message]
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

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=20181029152126.32610-1-milian.wolff@kdab.com \
    --to=milian.wolff@kdab.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).