summaryrefslogtreecommitdiff
path: root/addr2line.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 23:52:28 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 23:52:28 (GMT)
commit447d7a394fb01b2fe86f4130517f32d7c177d9f9 (patch)
treec2b9c015ef0a5677ee5d26b1f35729192d7904d6 /addr2line.c
parentf60c2d396dc1610a4108e38415e2b70481bd5cd1 (diff)
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
Diffstat (limited to 'addr2line.c')
-rw-r--r--addr2line.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/addr2line.c b/addr2line.c
index 928a82c..8df0247 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);
}