aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 23:52:28 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 23:52:28 +0000
commit160c730f21edfdb6a3b1d7f4f53a15e6510c60a4 (patch)
treec2b9c015ef0a5677ee5d26b1f35729192d7904d6
parent9a80105d73cc2925d2a4f77eac25b786d6b5251d (diff)
downloadruby-160c730f21edfdb6a3b1d7f4f53a15e6510c60a4.tar.gz
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
-rw-r--r--addr2line.c20
1 files 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);
}