This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[commit] Add support for DW_LLE_start_length_entry (DEBUG_LOC_START_LENGTH)


Hi.

fyi, I've committed this.

In another patch I'll update debug_loc_kind to use the names from the spec.
The spec didn't originally have names for these.
ref: http://gcc.gnu.org/wiki/DebugFission

Regression tested on amd64-linux (with/without fission).

2012-06-14  Doug Evans  <dje@google.com>

	* dwarf2loc.c (debug_loc_kind): Add DEBUG_LOC_START_LENGTH.
	(DEBUG_LOC_START_END): Renamed from DEBUG_LOC_NORMAL.
	All uses updated.
	(decode_debug_loc_dwo_addresses): New arg "byte_order".  All callers
	updated.  Handle DEBUG_LOC_START_LENGTH.
	(dwarf2_find_location_expression): Handle DEBUG_LOC_START_LENGTH.
	(loclist_describe_location): Ditto.

Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.147
diff -u -p -r1.147 dwarf2loc.c
--- dwarf2loc.c	24 May 2012 01:26:15 -0000	1.147
+++ dwarf2loc.c	14 Jun 2012 22:51:07 -0000
@@ -75,7 +75,13 @@ enum debug_loc_kind
   /* This is followed by two unsigned LEB128 numbers that are indices into
      .debug_addr and specify the beginning and ending addresses, and then
      a normal location expression as in .debug_loc.  */
-  DEBUG_LOC_NORMAL = 2,
+  DEBUG_LOC_START_END = 2,
+
+  /* This is followed by an unsigned LEB128 number that is an index into
+     .debug_addr and specifies the beginning address, and a 4 byte unsigned
+     number that specifies the length, and then a normal location expression
+     as in .debug_loc.  */
+  DEBUG_LOC_START_LENGTH = 3,
 
   /* An internal value indicating there is insufficient data.  */
   DEBUG_LOC_BUFFER_OVERFLOW = -1,
@@ -124,7 +130,7 @@ decode_debug_loc_addresses (const gdb_by
   if (*low == 0 && *high == 0)
     return DEBUG_LOC_END_OF_LIST;
 
-  return DEBUG_LOC_NORMAL;
+  return DEBUG_LOC_START_END;
 }
 
 /* Decode the addresses in .debug_loc.dwo entry.
@@ -137,7 +143,8 @@ decode_debug_loc_dwo_addresses (struct d
 				const gdb_byte *loc_ptr,
 				const gdb_byte *buf_end,
 				const gdb_byte **new_ptr,
-				CORE_ADDR *low, CORE_ADDR *high)
+				CORE_ADDR *low, CORE_ADDR *high,
+				enum bfd_endian byte_order)
 {
   uint64_t low_index, high_index;
 
@@ -157,7 +164,7 @@ decode_debug_loc_dwo_addresses (struct d
       *high = dwarf2_read_addr_index (per_cu, high_index);
       *new_ptr = loc_ptr;
       return DEBUG_LOC_BASE_ADDRESS;
-    case DEBUG_LOC_NORMAL:
+    case DEBUG_LOC_START_END:
       loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &low_index);
       if (loc_ptr == NULL)
 	return DEBUG_LOC_BUFFER_OVERFLOW;
@@ -167,7 +174,18 @@ decode_debug_loc_dwo_addresses (struct d
 	return DEBUG_LOC_BUFFER_OVERFLOW;
       *high = dwarf2_read_addr_index (per_cu, high_index);
       *new_ptr = loc_ptr;
-      return DEBUG_LOC_NORMAL;
+      return DEBUG_LOC_START_END;
+    case DEBUG_LOC_START_LENGTH:
+      loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &low_index);
+      if (loc_ptr == NULL)
+	return DEBUG_LOC_BUFFER_OVERFLOW;
+      *low = dwarf2_read_addr_index (per_cu, low_index);
+      if (loc_ptr + 4 > buf_end)
+	return DEBUG_LOC_BUFFER_OVERFLOW;
+      *high = *low;
+      *high += extract_unsigned_integer (loc_ptr, 4, byte_order);
+      *new_ptr = loc_ptr + 4;
+      return DEBUG_LOC_START_LENGTH;
     default:
       return DEBUG_LOC_INVALID_ENTRY;
     }
@@ -208,7 +226,7 @@ dwarf2_find_location_expression (struct 
       if (baton->from_dwo)
 	kind = decode_debug_loc_dwo_addresses (baton->per_cu,
 					       loc_ptr, buf_end, &new_ptr,
-					       &low, &high);
+					       &low, &high, byte_order);
       else
 	kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr,
 					   &low, &high,
@@ -223,7 +241,8 @@ dwarf2_find_location_expression (struct 
 	case DEBUG_LOC_BASE_ADDRESS:
 	  base_address = high + base_offset;
 	  continue;
-	case DEBUG_LOC_NORMAL:
+	case DEBUG_LOC_START_END:
+	case DEBUG_LOC_START_LENGTH:
 	  break;
 	case DEBUG_LOC_BUFFER_OVERFLOW:
 	case DEBUG_LOC_INVALID_ENTRY:
@@ -3979,7 +3998,7 @@ loclist_describe_location (struct symbol
       if (dlbaton->from_dwo)
 	kind = decode_debug_loc_dwo_addresses (dlbaton->per_cu,
 					       loc_ptr, buf_end, &new_ptr,
-					       &low, &high);
+					       &low, &high, byte_order);
       else
 	kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr,
 					   &low, &high,
@@ -3996,7 +4015,8 @@ loclist_describe_location (struct symbol
 	  fprintf_filtered (stream, _("  Base address %s"),
 			    paddress (gdbarch, base_address));
 	  continue;
-	case DEBUG_LOC_NORMAL:
+	case DEBUG_LOC_START_END:
+	case DEBUG_LOC_START_LENGTH:
 	  break;
 	case DEBUG_LOC_BUFFER_OVERFLOW:
 	case DEBUG_LOC_INVALID_ENTRY:


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