Patchwork [RFC,gdb/testsuite] Fix base address selection entry encoding in dw2-skip-prologue.S

login
register
mail settings
Submitter Tom de Vries
Date March 7, 2019, 12:11 p.m.
Message ID <20190307121149.GA14543@delia>
Download mbox | patch
Permalink /patch/31765/
State New
Headers show

Comments

Tom de Vries - March 7, 2019, 12:11 p.m.
Hi,

A base address selection entry in a location list consist of two (constant or
relocated) address offsets.  The two offsets are the same size as an address
on the target machine.

The test-case gdb.dwarf2/dw2-skip-prologue.S encodes a base address selection
entry using .4byte, which is incorrect for 8-byte pointer size.  [ Which
triggers an assert in dwz, see PR dwz/24172. ]

Fix this by using PTRBYTE instead.

Tested on x86_64-linux.

Do we fix this type of errors in the testsuite?  AFAICT, the invalid dwarf is
not intentional.

Thanks,
- Tom

[gdb/testsuite] Fix base address selection entry encoding in dw2-skip-prologue.S

gdb/testsuite/ChangeLog:

2019-03-07  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/dw2-skip-prologue.S (.debug_loc): Fix base address
	selection entry encoding.

---
 gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Tom de Vries - April 23, 2019, 2:21 p.m.
On 07-03-19 13:11, Tom de Vries wrote:
> Hi,
> 
> A base address selection entry in a location list consist of two (constant or
> relocated) address offsets.  The two offsets are the same size as an address
> on the target machine.
> 
> The test-case gdb.dwarf2/dw2-skip-prologue.S encodes a base address selection
> entry using .4byte, which is incorrect for 8-byte pointer size.  [ Which
> triggers an assert in dwz, see PR dwz/24172. ]
> 
> Fix this by using PTRBYTE instead.
> 
> Tested on x86_64-linux.
> 
> Do we fix this type of errors in the testsuite?  AFAICT, the invalid dwarf is
> not intentional.
> 

Ping.

Thanks,
- Tom

> [gdb/testsuite] Fix base address selection entry encoding in dw2-skip-prologue.S
> 
> gdb/testsuite/ChangeLog:
> 
> 2019-03-07  Tom de Vries  <tdevries@suse.de>
> 
> 	* gdb.dwarf2/dw2-skip-prologue.S (.debug_loc): Fix base address
> 	selection entry encoding.
> 
> ---
>  gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
> index cef6e6df12..a55699fdc6 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
> @@ -123,7 +123,7 @@
>  	.section	.debug_loc
>  loclist:
>  	/* Reset the location list base address first.  */
> -	.4byte		-1, 0
> +	PTRBYTE		-1, 0
>  
>  	PTRBYTE		func_start, func_end
>  	.2byte		2f-1f
>
Tom de Vries - May 7, 2019, 2:50 p.m.
On 23-04-19 16:21, Tom de Vries wrote:
> On 07-03-19 13:11, Tom de Vries wrote:
>> Hi,
>>
>> A base address selection entry in a location list consist of two (constant or
>> relocated) address offsets.  The two offsets are the same size as an address
>> on the target machine.
>>
>> The test-case gdb.dwarf2/dw2-skip-prologue.S encodes a base address selection
>> entry using .4byte, which is incorrect for 8-byte pointer size.  [ Which
>> triggers an assert in dwz, see PR dwz/24172. ]
>>
>> Fix this by using PTRBYTE instead.
>>
>> Tested on x86_64-linux.
>>
>> Do we fix this type of errors in the testsuite?  AFAICT, the invalid dwarf is
>> not intentional.
>>
> 

Ping.

Thanks,
- Tom
> 
>> [gdb/testsuite] Fix base address selection entry encoding in dw2-skip-prologue.S
>>
>> gdb/testsuite/ChangeLog:
>>
>> 2019-03-07  Tom de Vries  <tdevries@suse.de>
>>
>> 	* gdb.dwarf2/dw2-skip-prologue.S (.debug_loc): Fix base address
>> 	selection entry encoding.
>>
>> ---
>>  gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
>> index cef6e6df12..a55699fdc6 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
>> @@ -123,7 +123,7 @@
>>  	.section	.debug_loc
>>  loclist:
>>  	/* Reset the location list base address first.  */
>> -	.4byte		-1, 0
>> +	PTRBYTE		-1, 0
>>  
>>  	PTRBYTE		func_start, func_end
>>  	.2byte		2f-1f
>>
Tom de Vries - May 14, 2019, 6:53 a.m.
On 07-05-19 16:50, Tom de Vries wrote:
> On 23-04-19 16:21, Tom de Vries wrote:
>> On 07-03-19 13:11, Tom de Vries wrote:
>>> Hi,
>>>
>>> A base address selection entry in a location list consist of two (constant or
>>> relocated) address offsets.  The two offsets are the same size as an address
>>> on the target machine.
>>>
>>> The test-case gdb.dwarf2/dw2-skip-prologue.S encodes a base address selection
>>> entry using .4byte, which is incorrect for 8-byte pointer size.  [ Which
>>> triggers an assert in dwz, see PR dwz/24172. ]
>>>
>>> Fix this by using PTRBYTE instead.
>>>
>>> Tested on x86_64-linux.
>>>
>>> Do we fix this type of errors in the testsuite?  AFAICT, the invalid dwarf is
>>> not intentional.
>>>
>>
> 
> Ping.
> 
> Thanks,
> - Tom
>>
>>> [gdb/testsuite] Fix base address selection entry encoding in dw2-skip-prologue.S
>>>
>>> gdb/testsuite/ChangeLog:
>>>
>>> 2019-03-07  Tom de Vries  <tdevries@suse.de>
>>>
>>> 	* gdb.dwarf2/dw2-skip-prologue.S (.debug_loc): Fix base address
>>> 	selection entry encoding.
>>>
>>> ---
>>>  gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
>>> index cef6e6df12..a55699fdc6 100644
>>> --- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
>>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
>>> @@ -123,7 +123,7 @@
>>>  	.section	.debug_loc
>>>  loclist:
>>>  	/* Reset the location list base address first.  */
>>> -	.4byte		-1, 0
>>> +	PTRBYTE		-1, 0
>>>  
>>>  	PTRBYTE		func_start, func_end
>>>  	.2byte		2f-1f
>>>
Andrew Burgess - May 14, 2019, 8:03 a.m.
* Tom de Vries <tdevries@suse.de> [2019-03-07 13:11:50 +0100]:

> Hi,
> 
> A base address selection entry in a location list consist of two (constant or
> relocated) address offsets.  The two offsets are the same size as an address
> on the target machine.
> 
> The test-case gdb.dwarf2/dw2-skip-prologue.S encodes a base address selection
> entry using .4byte, which is incorrect for 8-byte pointer size.  [ Which
> triggers an assert in dwz, see PR dwz/24172. ]
> 
> Fix this by using PTRBYTE instead.
> 
> Tested on x86_64-linux.
> 
> Do we fix this type of errors in the testsuite?  AFAICT, the invalid dwarf is
> not intentional.
> 
> Thanks,
> - Tom
> 
> [gdb/testsuite] Fix base address selection entry encoding in dw2-skip-prologue.S
> 
> gdb/testsuite/ChangeLog:
> 
> 2019-03-07  Tom de Vries  <tdevries@suse.de>
> 
> 	* gdb.dwarf2/dw2-skip-prologue.S (.debug_loc): Fix base address
> 	selection entry encoding.

This patch looks great.  Please go ahead and apply it.

Thanks,
Andrew



> 
> ---
>  gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
> index cef6e6df12..a55699fdc6 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
> @@ -123,7 +123,7 @@
>  	.section	.debug_loc
>  loclist:
>  	/* Reset the location list base address first.  */
> -	.4byte		-1, 0
> +	PTRBYTE		-1, 0
>  
>  	PTRBYTE		func_start, func_end
>  	.2byte		2f-1f

Patch

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
index cef6e6df12..a55699fdc6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
@@ -123,7 +123,7 @@ 
 	.section	.debug_loc
 loclist:
 	/* Reset the location list base address first.  */
-	.4byte		-1, 0
+	PTRBYTE		-1, 0
 
 	PTRBYTE		func_start, func_end
 	.2byte		2f-1f