* [PATCH] libdw: Make __libdw_dieabbrev more robust on failure.
@ 2018-06-13 22:42 Mark Wielaard
2018-06-16 22:55 ` Mark Wielaard
0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2018-06-13 22:42 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
Make sure to always set die->abbrev to DWARF_END_ABBREV on failure.
DWARF_END_ABBREV is also what the function reports on failure. And it
will prevent trying to lookup the abbrev ever again.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libdw/ChangeLog | 5 +++++
libdw/libdwP.h | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 07a1346b..78321654 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-12 Mark Wielaard <mark@klomp.org>
+
+ * libdw.h (__libdw_dieabbrev): Set die->abbrev to DWARF_END_ABBREV
+ on failure.
+
2018-06-10 Mark Wielaard <mark@klomp.org>
* dwarf_attr_integrate.c (dwarf_attr_integrate): Stop after 16 DIE
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 3d8e145a..eebb7d12 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -653,8 +653,9 @@ __libdw_dieabbrev (Dwarf_Die *die, const unsigned char **readp)
/* Get the abbreviation code. */
unsigned int code;
const unsigned char *addr = die->addr;
- if (die->cu == NULL || addr >= (const unsigned char *) die->cu->endp)
- return DWARF_END_ABBREV;
+ if (unlikely (die->cu == NULL
+ || addr >= (const unsigned char *) die->cu->endp))
+ return die->abbrev = DWARF_END_ABBREV;
get_uleb128 (code, addr, die->cu->endp);
if (readp != NULL)
*readp = addr;
--
2.17.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] libdw: Make __libdw_dieabbrev more robust on failure.
2018-06-13 22:42 [PATCH] libdw: Make __libdw_dieabbrev more robust on failure Mark Wielaard
@ 2018-06-16 22:55 ` Mark Wielaard
0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2018-06-16 22:55 UTC (permalink / raw)
To: elfutils-devel
On Thu, 2018-06-14 at 00:42 +0200, Mark Wielaard wrote:
> Make sure to always set die->abbrev to DWARF_END_ABBREV on failure.
> DWARF_END_ABBREV is also what the function reports on failure. And it
> will prevent trying to lookup the abbrev ever again.
Pushed to master.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-16 22:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-13 22:42 [PATCH] libdw: Make __libdw_dieabbrev more robust on failure Mark Wielaard
2018-06-16 22:55 ` 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).