RE: [PATCH] Support for DWARF5 location lists entries

Achra, Nitika
2020-01-16T11:29:27Z

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hi Simon,

Please find the attachment.

*Handle 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.

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

This is an effort to support DWARF5 in gdb.

Regards,
Nitika Achra

-----Original Message-----
From: Simon Marchi <simark@simark.ca>
Sent: Tuesday, January 14, 2020 9:59 PM
To: Achra, Nitika <Nitika.Achra@amd.com>; gdb-patches@sourceware.org
Cc: Ali Tamur <tamur@google.com>; George, Jini Susan <JiniSusan.George@amd.com>
Subject: Re: [PATCH] Support for DWARF5 location lists entries

[CAUTION: External Email]

On 2020-01-14 2:02 a.m., Achra, Nitika wrote:
> [AMD Official Use Only - Internal Distribution Only]
>
> Hi Simon,
>
> Sorry, I missed the comment. And I will try to setup the git-send-email before the next patch. Thank you.

Thanks.

I could push this patch on your behalf, but I am having trouble applying it, probably because your client (I'm guessing outlook?) has messed with it. Could you please generate it with git-format-patch and send it as an attachment? This way it should arrive intact.

Simon

[-- Attachment #2: 0001-Support-for-DWARF5-location-lists-entries.patch --]
[-- Type: application/octet-stream, Size: 2314 bytes --]

From 34e3bb9ba58ee73713574c14df718943d5ee50f3 Mon Sep 17 00:00:00 2001
From: nitachra <Nitika.Achra@amd.com>
Date: Thu, 16 Jan 2020 16:43:21 +0530
Subject: [PATCH] Support for DWARF5 location lists entries

---
gdb/dwarf2loc.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)

diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 1fe6829100..cf358fbe61 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -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;
}
--
2.17.1