[RFA,28/42] Set list_in_scope later in DWARF reader

Message ID 20180523045851.11660-29-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey May 23, 2018, 4:58 a.m. UTC
  Currently the DWARF reader sets the list_in_scope member of the CU
when first starting to process symbols.  Future changes will make this
assert -- code will not be able to refer to these lists until after
start_symtab has been called.  This patch prepares for the problem by
arranging to initialize list_in_scope in dwarf2_start_symtab.

gdb/ChangeLog
2018-05-22  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (process_full_comp_unit): Do not set list_in_scope.
	(process_full_type_unit): Likewise.
	(dwarf2_start_symtab): Set list_in_scope.
---
 gdb/ChangeLog    | 6 ++++++
 gdb/dwarf2read.c | 6 ++----
 2 files changed, 8 insertions(+), 4 deletions(-)
  

Comments

Keith Seitz July 6, 2018, 6:11 p.m. UTC | #1
On 05/22/2018 09:58 PM, Tom Tromey wrote:
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 3cc15ab645..f7cca01445 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -21138,6 +21134,8 @@ dwarf2_start_symtab (struct dwarf2_cu *cu,
>      = start_symtab (cu->per_cu->dwarf2_per_objfile->objfile, name, comp_dir,
>  		    low_pc, cu->language);
>  
> +  cu->list_in_scope = get_file_symbols ();
> +
>    record_debugformat ("DWARF 2");
>    record_producer (cu->producer);
>  
> 

Warning: `get_file_symbols' is undefined until the next patch.

Keith
  
Simon Marchi July 10, 2018, 3:23 a.m. UTC | #2
On 2018-07-06 02:11 PM, Keith Seitz wrote:
> On 05/22/2018 09:58 PM, Tom Tromey wrote:
>> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
>> index 3cc15ab645..f7cca01445 100644
>> --- a/gdb/dwarf2read.c
>> +++ b/gdb/dwarf2read.c
>> @@ -21138,6 +21134,8 @@ dwarf2_start_symtab (struct dwarf2_cu *cu,
>>      = start_symtab (cu->per_cu->dwarf2_per_objfile->objfile, name, comp_dir,
>>  		    low_pc, cu->language);
>>  
>> +  cu->list_in_scope = get_file_symbols ();
>> +
>>    record_debugformat ("DWARF 2");
>>    record_producer (cu->producer);
>>  
>>
> 
> Warning: `get_file_symbols' is undefined until the next patch.
> 
> Keith
> 

Indeed, though the principle sounds good.

Simon
  
Tom Tromey July 15, 2018, 5:55 p.m. UTC | #3
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> On 05/22/2018 09:58 PM, Tom Tromey wrote:
>> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
>> index 3cc15ab645..f7cca01445 100644
>> --- a/gdb/dwarf2read.c
>> +++ b/gdb/dwarf2read.c
>> @@ -21138,6 +21134,8 @@ dwarf2_start_symtab (struct dwarf2_cu *cu,
>> = start_symtab (cu->per_cu->dwarf2_per_objfile->objfile, name, comp_dir,
>> low_pc, cu->language);
>> 
>> +  cu->list_in_scope = get_file_symbols ();
>> +
>> record_debugformat ("DWARF 2");
>> record_producer (cu->producer);
>> 
>> 

Keith> Warning: `get_file_symbols' is undefined until the next patch.

Thanks.  I've fixed this.
I'll make sure to build each patch in the series before re-sending.

Tom
  

Patch

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 3cc15ab645..f7cca01445 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10281,8 +10281,6 @@  process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
   /* Clear the list here in case something was left over.  */
   cu->method_list.clear ();
 
-  cu->list_in_scope = &file_symbols;
-
   cu->language = pretend_language;
   cu->language_defn = language_def (cu->language);
 
@@ -10386,8 +10384,6 @@  process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
   /* Clear the list here in case something was left over.  */
   cu->method_list.clear ();
 
-  cu->list_in_scope = &file_symbols;
-
   cu->language = pretend_language;
   cu->language_defn = language_def (cu->language);
 
@@ -21138,6 +21134,8 @@  dwarf2_start_symtab (struct dwarf2_cu *cu,
     = start_symtab (cu->per_cu->dwarf2_per_objfile->objfile, name, comp_dir,
 		    low_pc, cu->language);
 
+  cu->list_in_scope = get_file_symbols ();
+
   record_debugformat ("DWARF 2");
   record_producer (cu->producer);