[PATCH] gdb: reset/recompute objfile section offsets in reread_symbols

Simon Marchi simark@simark.ca
Wed May 20 19:34:18 GMT 2020


On 2020-05-20 3:24 p.m., Christian Biesinger via Gdb-patches wrote:
> On Wed, May 20, 2020 at 2:22 PM Simon Marchi via Gdb-patches
> <gdb-patches@sourceware.org> wrote:
>> diff --git a/gdb/symfile.c b/gdb/symfile.c
>> index dd8192a67fbb..b02a9235663b 100644
>> --- a/gdb/symfile.c
>> +++ b/gdb/symfile.c
>> @@ -2543,6 +2543,11 @@ reread_symbols (void)
>>              will need to be called (see discussion below).  */
>>           obstack_free (&objfile->objfile_obstack, 0);
>>           objfile->sections = NULL;
>> +         objfile->section_offsets.clear ();
>> +         objfile->sect_index_bss = -1;
>> +         objfile->sect_index_data = -1;
>> +         objfile->sect_index_rodata = -1;
>> +         objfile->sect_index_text = -1;
> 
> Would it make sense to have a reset() function on objfile instead,
> that handles all necesary clearing of members?
> 
> Christian
> 

Probably not ideal, but probably better than what we have now.  At least
the knowledge of how to reset an objfile to an original state would be in
the objfile class itself.

I think it would be nicer to just free the objfile and create a new one from
scratch, although I don't know what other problems come with that.

Simon


More information about the Gdb-patches mailing list