ruby-changes:52890
From: naruse <ko1@a...>
Date: Wed, 17 Oct 2018 08:52:32 +0900 (JST)
Subject: [ruby-changes:52890] naruse:r65102 (trunk): The value of .debug_ranges are uintptr_t
naruse 2018-10-17 08:52:28 +0900 (Wed, 17 Oct 2018) New Revision: 65102 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65102 Log: The value of .debug_ranges are uintptr_t Modified files: trunk/addr2line.c Index: addr2line.c =================================================================== --- addr2line.c (revision 65101) +++ addr2line.c (revision 65102) @@ -827,6 +827,18 @@ read_uint64(char **ptr) https://github.com/ruby/ruby/blob/trunk/addr2line.c#L827 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, https://github.com/ruby/ruby/blob/trunk/addr2line.c#L1365 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, https://github.com/ruby/ruby/blob/trunk/addr2line.c#L1397 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/