From 160c730f21edfdb6a3b1d7f4f53a15e6510c60a4 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 16 Oct 2018 23:52:28 +0000 Subject: The value of .debug_ranges are uintptr_t git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- addr2line.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/addr2line.c b/addr2line.c index 928a82c264..8df0247ed2 100644 --- a/addr2line.c +++ b/addr2line.c @@ -827,6 +827,18 @@ read_uint64(char **ptr) return get_uint64(p); } +static uintptr_t +read_uintptr(char **ptr) +{ + const unsigned char *p = (const unsigned char *)*ptr; + *ptr = (char *)(p + SIZEOF_VOIDP); +#if SIZEOF_VOIDP == 8 + return get_uint64(p); +#else + return get_uint32(p); +#endif +} + static uint64_t read_uint(DebugInfoReader *reader) { @@ -1353,8 +1365,8 @@ ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr) else if (ptr->ranges_set) { char *p = reader->obj->debug_ranges.ptr + ptr->ranges; for (;;) { - uint64_t from = read_uint64(&p); - uint64_t to = read_uint64(&p); + uintptr_t from = read_uintptr(&p); + uintptr_t to = read_uintptr(&p); if (!from && !to) break; if (from <= addr && addr <= to) { return from; @@ -1385,8 +1397,8 @@ ranges_inspect(DebugInfoReader *reader, ranges_t *ptr) fprintf(stderr,"low_pc:%lx ranges:%lx ",ptr->low_pc,ptr->ranges); p = reader->obj->debug_ranges.ptr + ptr->ranges; for (;;) { - uint64_t from = read_uint64(&p); - uint64_t to = read_uint64(&p); + uintptr_t from = read_uintptr(&p); + uintptr_t to = read_uintptr(&p); if (!from && !to) break; fprintf(stderr,"%lx-%lx ",ptr->low_pc+from,ptr->low_pc+to); } -- cgit v1.2.3