RE: Issue in dwarf2/expr.c

"Rohr, Stephan via Gdb" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <DM6PR11MB4564CA8599DD9E64D595317193F29@DM6PR11MB4564.namprd11.prod.outlook.com>
Hi Tom,

Thanks for your feedback. 

The 'embedded_offset' is considered in the ' value_contents_raw (v)' function call whereas the 'offset' is handled in 'rw_pieced_value'. So from my understanding it should work as expected. I will check for regressions and submit a patch.

Best
stephan

-----Original Message-----
From: Tom Tromey <[email protected]> 
Sent: Friday, April 15, 2022 10:25 PM
To: Andreas Arnez <[email protected]>
Cc: Rohr, Stephan via Gdb <[email protected]>; Rohr, Stephan <[email protected]>; Tom Tromey <[email protected]>
Subject: Re: Issue in dwarf2/expr.c

>> I came across a bug in dwarf2/expr.c:177 in function  rw_pieced_value. when reading a pieced value described by DW_OP_piece or DW_OP_bit_piece.
>> 
>> if (value_type (v) != value_enclosing_type (v)) internal_error 
>> (__FILE__, __LINE__, _("Should not be able to create a lazy value 
>> with "
>> "an enclosing type"));

> Since I did some work on this function in the past, I just looked 
> where this check comes from, and it turns out that it was introduced 
> in 2010 by Tom Tromey with commit 
> afd74c5ff76010405caddd2834be4a0178fa93dd --

> gdb
> 	* dwarf2loc.c (read_pieced_value): Work properly when 'v' has an
> 	offset.
> 	(write_pieced_value): Likewise.

> Perhaps Tom still remembers the rationale?

I don't remember, sorry.
It's possible I assumed that it should be impossible to create a value with an enclosing type without un-lazying it.

Removing the assertion seems fine but it's important to make sure the result works correctly.  An enclosing type normally means that the data representing the 'type' is at some offset in the contents, but it seems to me that rw_pieced_value may not handle this case.

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.