bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Broken assumption in readelf.c about location lists and compilation unit


From: Fred Fish
Subject: Broken assumption in readelf.c about location lists and compilation units
Date: Wed, 29 Dec 2004 16:18:31 -0700
User-agent: KMail/1.7.1

The code in readelf.c which dumps the debug_loc section currently makes the 
assumption
that the location list terminator (start and end addresses of zero) marks the 
end
of location lists for a compilation unit.  Actually these mark the end of just a
single location list.  So if there are more location lists than compilation 
units,
you get a bogus warning message.

This was also noted in the gcc bug report followup comments by Daniel Berlin at:

 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19124

I stumbled across this problem independently via:

  $ cat s.c
  main ()
  {
    {
      int x;
      x = getpid ();
      printf ("pid = %d\n", x);
    }
    {
      int x;
      x = getuid ();
      printf ("uid = %d\n", x);
    }
  }
  $ gcc -g -O2 -o s s.c
  s.c: In function ��main��:
  s.c:6: warning: incompatible implicit declaration of built-in function 
��printf��
  s.c:11: warning: incompatible implicit declaration of built-in function 
��printf��
  $ readelf --debug-dump s >s.debug
  readelf: Warning: .debug_loc section has more comp units than .debug_info 
section
  readelf: Warning: assuming that the pointer size is 4, from the last comp 
unit in .debug_info
  
-Fred





reply via email to

[Prev in Thread] Current Thread [Next in Thread]