bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: readelf does not read in .debug_aranges headercorrectly


From: Nick Clifton
Subject: Re: readelf does not read in .debug_aranges headercorrectly
Date: 02 Oct 2001 10:05:13 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi Miwako,

> I forgot to mention this.
> You might want to do the similar to .debug_pubnames.

Indeed.  In fact according the the latest draft of the proposed DWARF3
standard the .debug_info, .debug_line, and .debug_pubtypes sections
can also have this behaviour, as well as the length field in the CIE
and FDE structures in the .debug_frame section.  So I have extended my
original patch with the extra tests below.  I also modified the
warning message to be a little more informative.

Cheers
        Nick

2001-10-02  Nick Clifton  <address@hidden>

        * readelf.c (display_debug_line, display_debug_pubnames,
        display_debug_info, display_debug_frames): Detect and warn
        about 64-bit format entries.
        (display_debug_aranges): Reword 64-bit warning.
        (debug_displays): Add .debug_pubtypes as a known, but not yet
        supported, debug section.

Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.125
diff -p -r1.125 readelf.c
*** readelf.c   2001/10/01 16:15:50     1.125
--- readelf.c   2001/10/02 09:03:50
*************** display_debug_lines (section, start, fil
*** 5761,5766 ****
--- 5761,5773 ----
  
        /* Check the length of the block.  */
        info.li_length = BYTE_GET (external->li_length);
+ 
+       if (info.li_length == 0xffffffff)
+       {
+         warn (_("64-bit DWARF line info is not supported yet.\n"));
+         break;
+       }
+ 
        if (info.li_length + sizeof (external->li_length) > section->sh_size)
        {
          warn
*************** display_debug_pubnames (section, start, 
*** 5989,5994 ****
--- 5996,6007 ----
        data   = start + sizeof (* external);
        start += pubnames.pn_length + sizeof (external->pn_length);
  
+       if (pubnames.pn_length == 0xffffffff)
+       {
+         warn (_("64-bit DWARF pubnames are not supported yet.\n"));
+         break;
+       }
+ 
        if (pubnames.pn_version != 2)
        {
          static int warned = 0;
*************** display_debug_info (section, start, file
*** 7183,7188 ****
--- 7196,7207 ----
        compunit.cu_abbrev_offset = BYTE_GET (external->cu_abbrev_offset);
        compunit.cu_pointer_size  = BYTE_GET (external->cu_pointer_size);
  
+       if (compunit.cu_length == 0xffffffff)
+       {
+         warn (_("64-bit DWARF debug info is not supported yet.\n"));
+         break;
+       }
+ 
        /* Check for RELA relocations in the abbrev_offset address, and
           apply them.  */
        for (relsec = section_headers;
*************** display_debug_aranges (section, start, f
*** 7378,7384 ****
  
        if (arange.ar_length == 0xffffffff)
        {
!         warn (_("DWARF64 aranges not currently supported.\n"));
          break;
        }
  
--- 7397,7403 ----
  
        if (arange.ar_length == 0xffffffff)
        {
!         warn (_("64-bit DWARF aranges are not supported yet.\n"));
          break;
        }
  
*************** display_debug_frames (section, start, fi
*** 7597,7602 ****
--- 7616,7627 ----
        if (length == 0)
        return 1;
  
+       if (length == 0xffffffff)
+       {
+         warn (_("64-bit DWARF format frames are not supported yet.\n"));
+         break;
+       }
+ 
        block_end = saved_start + length + 4;
        cie_id = byte_get (start, 4); start += 4;
  
*************** debug_displays[] =
*** 8147,8152 ****
--- 8172,8178 ----
    { ".debug_frame",       display_debug_frames, NULL },
    { ".eh_frame",          display_debug_frames, NULL },
    { ".debug_macinfo",     display_debug_macinfo, NULL },
+   { ".debug_pubtypes",    display_debug_not_supported, NULL },
    { ".debug_str",         display_debug_not_supported, NULL },
    { ".debug_static_func", display_debug_not_supported, NULL },
    { ".debug_static_vars", display_debug_not_supported, NULL },





reply via email to

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