dwarf: check maps_init result

This fixes GCC 4.9.3 warnings (Linux/mipsel):

dwarf/Gfind_proc_info-lsb.c: In function 'locate_debug_info':
dwarf/Gfind_proc_info-lsb.c:244:23: warning: 'mi.buf_end' may be used
uninitialized in this function [-Wmaybe-uninitialized]
   struct map_iterator mi;
                       ^
dwarf/Gfind_proc_info-lsb.c:244:23: warning: 'mi.buf' may be used
uninitialized in this function [-Wmaybe-uninitialized]
In file included from dwarf/Gfind_proc_info-lsb.c:46:0:
./os-linux.h:292:27: warning: 'mi.buf_size' may be used uninitialized in
this function [-Wmaybe-uninitialized]
       munmap (mi->buf_end - mi->buf_size, mi->buf_size);
                           ^
dwarf/Gfind_proc_info-lsb.c:244:23: note: 'mi.buf_size' was declared here
   struct map_iterator mi;
                       ^
This commit is contained in:
Королев Сергей 2016-05-11 22:36:25 +03:00 committed by Dave Watson
parent 0326f1048a
commit ad0d7633bc

View File

@ -246,7 +246,9 @@ find_binary_for_address (unw_word_t ip, char *name, size_t name_size)
int pid = getpid ();
unsigned long segbase, mapoff, hi;
maps_init (&mi, pid);
if (maps_init (&mi, pid) != 0)
return 1;
while (maps_next (&mi, &segbase, &hi, &mapoff))
if (ip >= segbase && ip < hi)
{