Support for DWARF5 location lists entries
authorNitika Achra <Nitika.Achra@amd.com>
Thu, 16 Jan 2020 16:51:06 +0000 (11:51 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 16 Jan 2020 16:51:19 +0000 (11:51 -0500)
This patch handles DW_LLE_base_addressx, DW_LLE_startx_length and
DW_LLE_start_length.

Tested by running the testsuite before and after the patch and there is
no increase in the number of test cases that fails. Tested with both
-gdwarf-4 and -gdwarf-5 flags. Also tested -gslit-dwarf along with
-gdwarf-4 as well as -gdwarf5 flags.

This is an effort to support DWARF5 in gdb.

gdb/ChangeLog:

* dwarf2loc.c (decode_debug_loclists_addresses): Handle
DW_LLE_base_addressx, DW_LLE_startx_length, DW_LLE_start_length.

gdb/ChangeLog
gdb/dwarf2loc.c

index cd89a44733a685f9c4f75cee562b5effb4d4c555..5513bea8182f18d33e0bac03ebdb8821416b968f 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-16  Nitika Achra  <Nitika.Achra@amd.com>
+
+       * dwarf2loc.c (decode_debug_loclists_addresses): Handle
+       DW_LLE_base_addressx, DW_LLE_startx_length, DW_LLE_start_length.
+
 2020-01-15  Simon Marchi  <simon.marchi@efficios.com>
 
        * infcmd.c (post_create_inferior): Use get_thread_regcache
index 1fe6829100dbf062411fc57a25b2f9c41fa6d3ee..405b239ed421f17dc0621acf174f7631bd7e5e42 100644 (file)
@@ -173,6 +173,41 @@ decode_debug_loclists_addresses (struct dwarf2_per_cu_data *per_cu,
 
   switch (*loc_ptr++)
     {
+    case DW_LLE_base_addressx:
+      *low = 0;
+      loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
+      if (loc_ptr == NULL)
+        return DEBUG_LOC_BUFFER_OVERFLOW;
+      *high = dwarf2_read_addr_index (per_cu, u64);
+      *new_ptr = loc_ptr;
+      return DEBUG_LOC_BASE_ADDRESS;
+    case DW_LLE_startx_length:
+      loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
+      if (loc_ptr == NULL)
+        return DEBUG_LOC_BUFFER_OVERFLOW;
+      *low = dwarf2_read_addr_index (per_cu, u64);
+      *high = *low;
+      loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
+      if (loc_ptr == NULL)
+        return DEBUG_LOC_BUFFER_OVERFLOW;
+      *high += u64;
+      *new_ptr = loc_ptr;
+      return DEBUG_LOC_START_LENGTH;
+    case DW_LLE_start_length:
+      if (buf_end - loc_ptr < addr_size)
+        return DEBUG_LOC_BUFFER_OVERFLOW;
+      if (signed_addr_p)
+        *low = extract_signed_integer (loc_ptr, addr_size, byte_order);
+      else
+        *low = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
+      loc_ptr += addr_size;
+      *high = *low;
+      loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
+      if (loc_ptr == NULL)
+        return DEBUG_LOC_BUFFER_OVERFLOW;
+      *high += u64;
+      *new_ptr = loc_ptr;
+      return DEBUG_LOC_START_LENGTH;
     case DW_LLE_end_of_list:
       *new_ptr = loc_ptr;
       return DEBUG_LOC_END_OF_LIST;
@@ -197,6 +232,10 @@ decode_debug_loclists_addresses (struct dwarf2_per_cu_data *per_cu,
       *high = u64;
       *new_ptr = loc_ptr;
       return DEBUG_LOC_START_END;
+    /* Following cases are not supported yet.  */
+    case DW_LLE_startx_endx:
+    case DW_LLE_start_end:
+    case DW_LLE_default_location:
     default:
       return DEBUG_LOC_INVALID_ENTRY;
     }
This page took 0.033952 seconds and 4 git commands to generate.