This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fixes to dwarf2out.c WRT location lists


Hello,

this patch contains some bugfixes in current location list code.
These bugs were discovered while writing variable tracking
and these bugfixes are needed so that location lists would be correct.

First, there was an inverted compare of curr->section and ".text".
Second, if separate_line_info_table_in_use addr should be output instead of
delta.
Third, location list terminators should be DWARF2_ADDR_SIZE long.

Bootstrapped/regtested x86-64 (this patch only and together with other
var-tracking patches).

Josef

2004-02-02  Daniel Berlin  <dberlin@dberlin.org>

	* dwarf2out.c (output_loc_list): Inverted compare of curr->section and
	".text".  If separate_line_info_table_in_use output addr instead of
	delta.  Location list terminators should be DWARF2_ADDR_SIZE long.
	(output_die): Use dw2_asm_output_offset, not dw2_asm_output_delta, for
	location list labels.


*** dwarf2out.c.orig	2004-02-02 07:56:34.000000000 +0100
--- dwarf2out.c	2004-02-02 07:56:23.000000000 +0100
*************** output_loc_list (dw_loc_list_ref list_he
*** 6543,6549 ****
    /* ??? This shouldn't be needed now that we've forced the
       compilation unit base address to zero when there is code
       in more than one section.  */
!   if (strcmp (curr->section, ".text") == 0)
      {
        /* dw2_asm_output_data will mask off any extra bits in the ~0.  */
        dw2_asm_output_data (DWARF2_ADDR_SIZE, ~(unsigned HOST_WIDE_INT) 0,
--- 6639,6645 ----
    /* ??? This shouldn't be needed now that we've forced the
       compilation unit base address to zero when there is code
       in more than one section.  */
!   if (strcmp (curr->section, ".text") != 0)
      {
        /* dw2_asm_output_data will mask off any extra bits in the ~0.  */
        dw2_asm_output_data (DWARF2_ADDR_SIZE, ~(unsigned HOST_WIDE_INT) 0,
*************** output_loc_list (dw_loc_list_ref list_he
*** 6552,6567 ****
  			     "Location list base address specifier base");
      }
  
    for (curr = list_head; curr != NULL; curr = curr->dw_loc_next)
      {
        unsigned long size;
! 
!       dw2_asm_output_delta (DWARF2_ADDR_SIZE, curr->begin, curr->section,
! 			    "Location list begin address (%s)",
! 			    list_head->ll_symbol);
!       dw2_asm_output_delta (DWARF2_ADDR_SIZE, curr->end, curr->section,
! 			    "Location list end address (%s)",
! 			    list_head->ll_symbol);
        size = size_of_locs (curr->expr);
  
        /* Output the block length for this list of location operations.  */
--- 6648,6675 ----
  			     "Location list base address specifier base");
      }
  
+   /* Walk the location list, and output each range + expression.  */
    for (curr = list_head; curr != NULL; curr = curr->dw_loc_next)
      {
        unsigned long size;
!       if (separate_line_info_table_in_use == 0)
! 	{
! 	  dw2_asm_output_delta (DWARF2_ADDR_SIZE, curr->begin, curr->section,
! 				"Location list begin address (%s)",
! 				list_head->ll_symbol);
! 	  dw2_asm_output_delta (DWARF2_ADDR_SIZE, curr->end, curr->section,
! 				"Location list end address (%s)",
! 				list_head->ll_symbol);
! 	}
!       else
! 	{
! 	  dw2_asm_output_addr (DWARF2_ADDR_SIZE, curr->begin,
! 			       "Location list begin address (%s)",
! 			       list_head->ll_symbol);
! 	  dw2_asm_output_addr (DWARF2_ADDR_SIZE, curr->end,
! 			       "Location list end address (%s)",
! 			       list_head->ll_symbol);
! 	}
        size = size_of_locs (curr->expr);
  
        /* Output the block length for this list of location operations.  */
*************** output_loc_list (dw_loc_list_ref list_he
*** 6572,6581 ****
        output_loc_sequence (curr->expr);
      }
  
!   dw2_asm_output_data (DWARF_OFFSET_SIZE, 0,
  		       "Location list terminator begin (%s)",
  		       list_head->ll_symbol);
!   dw2_asm_output_data (DWARF_OFFSET_SIZE, 0,
  		       "Location list terminator end (%s)",
  		       list_head->ll_symbol);
  }
--- 6680,6689 ----
        output_loc_sequence (curr->expr);
      }
  
!   dw2_asm_output_data (DWARF2_ADDR_SIZE, 0,
  		       "Location list terminator begin (%s)",
  		       list_head->ll_symbol);
!   dw2_asm_output_data (DWARF2_ADDR_SIZE, 0,
  		       "Location list terminator end (%s)",
  		       list_head->ll_symbol);
  }
*************** output_die (dw_die_ref die)
*** 6695,6702 ****
  
  	    if (sym == 0)
  	      abort ();
! 	    dw2_asm_output_delta (DWARF_OFFSET_SIZE, sym,
! 				  loc_section_label, "%s", name);
  	  }
  	  break;
  
--- 6803,6809 ----
  
  	    if (sym == 0)
  	      abort ();
! 	    dw2_asm_output_offset (DWARF_OFFSET_SIZE, sym, "%s", name);
  	  }
  	  break;
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]