Do not pass section index to end_compunit_symtab

Right now, the section index passed to end_compunit_symtab is always
SECT_OFF_TEXT.  Remove this parameter and simply always use
SECT_OFF_TEXT.
This commit is contained in:
Tom Tromey
2023-01-13 09:08:41 -07:00
parent b8a6e98781
commit 83bad3162d
10 changed files with 32 additions and 46 deletions

View File

@ -171,11 +171,11 @@ free_buildsym_compunit (void)
} }
struct compunit_symtab * struct compunit_symtab *
end_compunit_symtab (CORE_ADDR end_addr, int section) end_compunit_symtab (CORE_ADDR end_addr)
{ {
gdb_assert (buildsym_compunit != nullptr); gdb_assert (buildsym_compunit != nullptr);
struct compunit_symtab *result struct compunit_symtab *result
= buildsym_compunit->end_compunit_symtab (end_addr, section); = buildsym_compunit->end_compunit_symtab (end_addr);
free_buildsym_compunit (); free_buildsym_compunit ();
return result; return result;
} }

View File

@ -70,8 +70,7 @@ extern void push_subfile ();
extern const char *pop_subfile (); extern const char *pop_subfile ();
extern struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr, extern struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr);
int section);
extern struct context_stack *push_context (int desc, CORE_ADDR valu); extern struct context_stack *push_context (int desc, CORE_ADDR valu);

View File

@ -854,7 +854,7 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
struct compunit_symtab * struct compunit_symtab *
buildsym_compunit::end_compunit_symtab_with_blockvector buildsym_compunit::end_compunit_symtab_with_blockvector
(struct block *static_block, int section, int expandable) (struct block *static_block, int expandable)
{ {
struct compunit_symtab *cu = m_compunit_symtab; struct compunit_symtab *cu = m_compunit_symtab;
struct blockvector *blockvector; struct blockvector *blockvector;
@ -974,7 +974,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
set_block_compunit_symtab (b, cu); set_block_compunit_symtab (b, cu);
} }
cu->set_block_line_section (section); cu->set_block_line_section (SECT_OFF_TEXT (m_objfile));
cu->set_macro_table (release_macros ()); cu->set_macro_table (release_macros ());
@ -1014,15 +1014,12 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
/* Implementation of the second part of end_compunit_symtab. Pass STATIC_BLOCK /* Implementation of the second part of end_compunit_symtab. Pass STATIC_BLOCK
as value returned by end_compunit_symtab_get_static_block. as value returned by end_compunit_symtab_get_static_block.
SECTION is the same as for end_compunit_symtab: the section number
(in objfile->section_offsets) of the blockvector and linetable.
If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made
expandable. */ expandable. */
struct compunit_symtab * struct compunit_symtab *
buildsym_compunit::end_compunit_symtab_from_static_block buildsym_compunit::end_compunit_symtab_from_static_block
(struct block *static_block, int section, int expandable) (struct block *static_block, int expandable)
{ {
struct compunit_symtab *cu; struct compunit_symtab *cu;
@ -1040,7 +1037,7 @@ buildsym_compunit::end_compunit_symtab_from_static_block
cu = NULL; cu = NULL;
} }
else else
cu = end_compunit_symtab_with_blockvector (static_block, section, expandable); cu = end_compunit_symtab_with_blockvector (static_block, expandable);
return cu; return cu;
} }
@ -1050,9 +1047,7 @@ buildsym_compunit::end_compunit_symtab_from_static_block
them), then make the struct symtab for that file and put it in the them), then make the struct symtab for that file and put it in the
list of all such. list of all such.
END_ADDR is the address of the end of the file's text. SECTION is END_ADDR is the address of the end of the file's text.
the section number (in objfile->section_offsets) of the blockvector
and linetable.
Note that it is possible for end_compunit_symtab() to return NULL. In Note that it is possible for end_compunit_symtab() to return NULL. In
particular, for the DWARF case at least, it will return NULL when particular, for the DWARF case at least, it will return NULL when
@ -1067,24 +1062,24 @@ buildsym_compunit::end_compunit_symtab_from_static_block
end_compunit_symtab_from_static_block yourself. */ end_compunit_symtab_from_static_block yourself. */
struct compunit_symtab * struct compunit_symtab *
buildsym_compunit::end_compunit_symtab (CORE_ADDR end_addr, int section) buildsym_compunit::end_compunit_symtab (CORE_ADDR end_addr)
{ {
struct block *static_block; struct block *static_block;
static_block = end_compunit_symtab_get_static_block (end_addr, 0, 0); static_block = end_compunit_symtab_get_static_block (end_addr, 0, 0);
return end_compunit_symtab_from_static_block (static_block, section, 0); return end_compunit_symtab_from_static_block (static_block, 0);
} }
/* Same as end_compunit_symtab except create a symtab that can be later added /* Same as end_compunit_symtab except create a symtab that can be later added
to. */ to. */
struct compunit_symtab * struct compunit_symtab *
buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr, int section) buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr)
{ {
struct block *static_block; struct block *static_block;
static_block = end_compunit_symtab_get_static_block (end_addr, 1, 0); static_block = end_compunit_symtab_get_static_block (end_addr, 1, 0);
return end_compunit_symtab_from_static_block (static_block, section, 1); return end_compunit_symtab_from_static_block (static_block, 1);
} }
/* Subroutine of augment_type_symtab to simplify it. /* Subroutine of augment_type_symtab to simplify it.

View File

@ -327,12 +327,11 @@ struct buildsym_compunit
(CORE_ADDR end_addr, int expandable, int required); (CORE_ADDR end_addr, int expandable, int required);
struct compunit_symtab *end_compunit_symtab_from_static_block struct compunit_symtab *end_compunit_symtab_from_static_block
(struct block *static_block, int section, int expandable); (struct block *static_block, int expandable);
struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr, int section); struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr);
struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr, struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr);
int section);
void augment_type_symtab (); void augment_type_symtab ();
@ -352,7 +351,7 @@ private:
void watch_main_source_file_lossage (); void watch_main_source_file_lossage ();
struct compunit_symtab *end_compunit_symtab_with_blockvector struct compunit_symtab *end_compunit_symtab_with_blockvector
(struct block *static_block, int section, int expandable); (struct block *static_block, int expandable);
/* The objfile we're reading debug info from. */ /* The objfile we're reading debug info from. */
struct objfile *m_objfile; struct objfile *m_objfile;

View File

@ -404,7 +404,7 @@ coff_end_compunit_symtab (struct objfile *objfile)
{ {
set_last_source_start_addr (current_source_start_addr); set_last_source_start_addr (current_source_start_addr);
end_compunit_symtab (current_source_end_addr, SECT_OFF_TEXT (objfile)); end_compunit_symtab (current_source_end_addr);
/* Reinitialize for beginning of new file. */ /* Reinitialize for beginning of new file. */
set_last_source_file (NULL); set_last_source_file (NULL);

View File

@ -1258,18 +1258,17 @@ ctf_start_compunit_symtab (ctf_psymtab *pst,
} }
/* Finish reading symbol/type definitions in CTF format. /* Finish reading symbol/type definitions in CTF format.
END_ADDR is the end address of the file's text. SECTION is END_ADDR is the end address of the file's text. */
the .text section number. */
static struct compunit_symtab * static struct compunit_symtab *
ctf_end_compunit_symtab (ctf_psymtab *pst, ctf_end_compunit_symtab (ctf_psymtab *pst,
CORE_ADDR end_addr, int section) CORE_ADDR end_addr)
{ {
struct ctf_context *ccp; struct ctf_context *ccp;
ccp = &pst->context; ccp = &pst->context;
struct compunit_symtab *result struct compunit_symtab *result
= ccp->builder->end_compunit_symtab (end_addr, section); = ccp->builder->end_compunit_symtab (end_addr);
delete ccp->builder; delete ccp->builder;
ccp->builder = nullptr; ccp->builder = nullptr;
return result; return result;
@ -1411,8 +1410,7 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
set_text_low (offset); set_text_low (offset);
set_text_high (offset + tsize); set_text_high (offset + tsize);
compunit_symtab = ctf_end_compunit_symtab (this, offset + tsize, compunit_symtab = ctf_end_compunit_symtab (this, offset + tsize);
SECT_OFF_TEXT (objfile));
/* Finish up the debug error message. */ /* Finish up the debug error message. */
if (info_verbose) if (info_verbose)

View File

@ -2331,8 +2331,7 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
if (get_last_source_start_addr () > text_offset) if (get_last_source_start_addr () > text_offset)
set_last_source_start_addr (text_offset); set_last_source_start_addr (text_offset);
pst->compunit_symtab = end_compunit_symtab (text_offset + text_size, pst->compunit_symtab = end_compunit_symtab (text_offset + text_size);
SECT_OFF_TEXT (objfile));
end_stabs (); end_stabs ();
@ -2594,7 +2593,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
patch_subfile_names (get_current_subfile (), name); patch_subfile_names (get_current_subfile (), name);
break; /* Ignore repeated SOs. */ break; /* Ignore repeated SOs. */
} }
end_compunit_symtab (valu, SECT_OFF_TEXT (objfile)); end_compunit_symtab (valu);
end_stabs (); end_stabs ();
} }

View File

@ -8457,7 +8457,7 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu); dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu);
cust = cu->get_builder ()->end_compunit_symtab_from_static_block cust = cu->get_builder ()->end_compunit_symtab_from_static_block
(static_block, SECT_OFF_TEXT (objfile), 0); (static_block, 0);
if (cust != NULL) if (cust != NULL)
{ {
@ -8508,7 +8508,6 @@ process_full_type_unit (dwarf2_cu *cu,
enum language pretend_language) enum language pretend_language)
{ {
dwarf2_per_objfile *per_objfile = cu->per_objfile; dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
struct compunit_symtab *cust; struct compunit_symtab *cust;
struct signatured_type *sig_type; struct signatured_type *sig_type;
@ -8542,7 +8541,7 @@ process_full_type_unit (dwarf2_cu *cu,
if (tug_unshare->compunit_symtab == NULL) if (tug_unshare->compunit_symtab == NULL)
{ {
buildsym_compunit *builder = cu->get_builder (); buildsym_compunit *builder = cu->get_builder ();
cust = builder->end_expandable_symtab (0, SECT_OFF_TEXT (objfile)); cust = builder->end_expandable_symtab (0);
tug_unshare->compunit_symtab = cust; tug_unshare->compunit_symtab = cust;
if (cust != NULL) if (cust != NULL)

View File

@ -3968,7 +3968,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
{ {
valu += section_offsets[SECT_OFF_TEXT (objfile)]; valu += section_offsets[SECT_OFF_TEXT (objfile)];
previous_stab_code = N_SO; previous_stab_code = N_SO;
cust = end_compunit_symtab (valu, SECT_OFF_TEXT (objfile)); cust = end_compunit_symtab (valu);
end_stabs (); end_stabs ();
last_symtab_ended = 1; last_symtab_ended = 1;
} }
@ -4028,8 +4028,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
if (! last_symtab_ended) if (! last_symtab_ended)
{ {
cust = end_compunit_symtab (pst->raw_text_high (), cust = end_compunit_symtab (pst->raw_text_high ());
SECT_OFF_TEXT (objfile));
end_stabs (); end_stabs ();
} }

View File

@ -1045,8 +1045,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
{ {
if (get_last_source_file ()) if (get_last_source_file ())
{ {
pst->compunit_symtab = end_compunit_symtab pst->compunit_symtab = end_compunit_symtab (cur_src_end_addr);
(cur_src_end_addr, SECT_OFF_TEXT (objfile));
end_stabs (); end_stabs ();
} }
@ -1136,8 +1135,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
{ {
complete_symtab (filestring, file_start_addr); complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr; cur_src_end_addr = file_end_addr;
end_compunit_symtab (file_end_addr, end_compunit_symtab (file_end_addr);
SECT_OFF_TEXT (objfile));
end_stabs (); end_stabs ();
start_stabs (); start_stabs ();
/* Give all csects for this source file the same /* Give all csects for this source file the same
@ -1243,7 +1241,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
complete_symtab (filestring, file_start_addr); complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr; cur_src_end_addr = file_end_addr;
end_compunit_symtab (file_end_addr, SECT_OFF_TEXT (objfile)); end_compunit_symtab (file_end_addr);
end_stabs (); end_stabs ();
/* XCOFF, according to the AIX 3.2 documentation, puts the /* XCOFF, according to the AIX 3.2 documentation, puts the
@ -1431,7 +1429,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
complete_symtab (filestring, file_start_addr); complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr; cur_src_end_addr = file_end_addr;
cust = end_compunit_symtab (file_end_addr, SECT_OFF_TEXT (objfile)); cust = end_compunit_symtab (file_end_addr);
/* When reading symbols for the last C_FILE of the objfile, try /* When reading symbols for the last C_FILE of the objfile, try
to make sure that we set pst->compunit_symtab to the symtab for the to make sure that we set pst->compunit_symtab to the symtab for the
file, not to the _globals_ symtab. I'm not sure whether this file, not to the _globals_ symtab. I'm not sure whether this