public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: Ian Lance Taylor <ian@airs.com>
Subject: [PATCH 4/9] [libbacktrace] Handle DW_FORM_GNU_strp_alt
Date: Tue, 11 Dec 2018 10:14:00 -0000	[thread overview]
Message-ID: <20181211101411.7067-5-tdevries@suse.de> (raw)
In-Reply-To: <20181211101411.7067-1-tdevries@suse.de>

Handle DW_FORM_GNU_strp_alt which references the .debug_str section in the
.gnu_debugaltlink file.

2018-11-11  Tom de Vries  <tdevries@suse.de>

	* dwarf.c (read_attribute): Handle DW_FORM_GNU_strp_alt
	using altlink.
---
 libbacktrace/dwarf.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c
index 8b802a085ca..341b84605c0 100644
--- a/libbacktrace/dwarf.c
+++ b/libbacktrace/dwarf.c
@@ -843,14 +843,23 @@ read_attribute (enum dwarf_form form, struct dwarf_buf *buf,
       val->encoding = ATTR_VAL_REF_SECTION;
       return 1;
     case DW_FORM_GNU_strp_alt:
-      val->u.uint = read_offset (buf, is_dwarf64);
-      if (altlink == NULL)
-	{
-	  val->encoding = ATTR_VAL_NONE;
-	  return 1;
-	}
-      val->encoding = ATTR_VAL_REF_SECTION;
-      return 1;
+      {
+	uint64_t offset;
+	offset = read_offset (buf, is_dwarf64);
+	if (altlink == NULL)
+	  {
+	    val->encoding = ATTR_VAL_NONE;
+	    return 1;
+	  }
+	if (offset >= altlink->dwarf_str_size)
+	  {
+	    dwarf_buf_error (buf, "DW_FORM_GNU_strp_alt out of range");
+	    return 0;
+	  }
+	val->encoding = ATTR_VAL_STRING;
+	val->u.string = (const char *) altlink->dwarf_str + offset;
+	return 1;
+      }
     default:
       dwarf_buf_error (buf, "unrecognized DWARF form");
       return 0;
-- 
2.16.4

  parent reply	other threads:[~2018-12-11 10:14 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 10:14 [PATCH 0/9] [libbacktrace] Handle .gnu_debugaltlink Tom de Vries
2018-12-11 10:14 ` [PATCH 7/9] [libbacktrace] Handle DW_FORM_GNU_ref_alt Tom de Vries
2019-01-17  0:17   ` Tom de Vries
2019-01-17  0:36     ` Ian Lance Taylor
2019-01-17 14:14       ` Tom de Vries
2019-01-17 14:16         ` Tom de Vries
2019-01-18 14:26         ` Ian Lance Taylor
2019-01-22 22:17           ` [libbacktrace] Use size_t for low_offset/high_offset fields of struct unit Tom de Vries
2019-01-22 23:05             ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 8/9] [libbacktrace] Add btest_dwz test-case Tom de Vries
2019-01-16  1:19   ` Ian Lance Taylor
2019-01-16 16:39     ` Tom de Vries
2019-01-16 18:30       ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 9/9] [libbacktrace] Add printdwarftest_dwz_cmp.sh test-case Tom de Vries
2019-01-17 13:58   ` Tom de Vries
2019-01-18 14:24     ` Ian Lance Taylor via gcc-patches
2019-01-19  0:45       ` Tom de Vries
2019-01-19  0:54         ` Ian Lance Taylor via gcc-patches
2019-01-22 22:03           ` Tom de Vries
2019-01-29 15:31             ` Ian Lance Taylor
2018-12-11 10:14 ` Tom de Vries [this message]
2019-01-16  1:07   ` [PATCH 4/9] [libbacktrace] Handle DW_FORM_GNU_strp_alt Ian Lance Taylor via gcc-patches
2018-12-11 10:14 ` [PATCH 2/9] [libbacktrace] Add altlink field to struct dwarf_data Tom de Vries
2019-01-16  1:02   ` Ian Lance Taylor
2019-01-16 16:33     ` Tom de Vries
2019-01-16 16:34       ` Tom de Vries
2019-01-16 22:20         ` Tom de Vries
2019-01-16 22:25           ` Ian Lance Taylor
2019-01-16 17:17       ` Ian Lance Taylor
2019-01-16 22:18         ` Tom de Vries
2019-01-16 22:40           ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 5/9] [libbacktrace] Unify function name preference handling Tom de Vries
2019-01-16  1:10   ` Ian Lance Taylor via gcc-patches
2018-12-11 10:14 ` [PATCH 6/9] [libbacktrace] Factor out read_referenced_name_1 Tom de Vries
2019-01-16  1:15   ` Ian Lance Taylor via gcc-patches
2019-01-16 16:37     ` Tom de Vries
2019-01-16 18:26       ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 1/9] [libbacktrace] Read .gnu_debugaltlink Tom de Vries
2019-01-16  0:56   ` Ian Lance Taylor via gcc-patches
2019-01-16 16:26     ` Tom de Vries
2019-01-16 17:15       ` Ian Lance Taylor via gcc-patches
2019-01-16 22:48         ` Tom de Vries
2019-01-16 23:21           ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 3/9] [libbacktrace] Handle alt FORMS without .gnu_debugaltlink Tom de Vries
2019-01-16  1:06   ` Ian Lance Taylor
2019-01-16 16:34     ` Tom de Vries
2019-01-16 18:24       ` Ian Lance Taylor

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=20181211101411.7067-5-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ian@airs.com \
    /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).