From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 6EE643858C50; Wed, 8 Feb 2023 16:46:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EE643858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675874803; bh=1byWB+C4f995pHbhYDn5JUDNdO86X1Y0/QYdeGuf+xo=; h=From:To:Subject:Date:From; b=nV6SJ0P4v6HGPYsOqY04rBslNqaJUFoxVOuGSI332fHFd/2zp0JqCpW+VrvQGjHA8 obIE483Gq21HrI5toSPbrUsz+MOW6ONZitaLtv04nl1Ab9794zZ6qMbBpj8/iSi81S Hy1a/ZtHI0xUBtNuAHp0Vic80ebL0KmQE+YpPwNo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Do not pass section index to end_compunit_symtab X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: b8a6e9878141f5f1ac6c790e85257eadd51fff8f X-Git-Newrev: 83bad3162d7303b51e2ec9b49cb9e78c72d27aa3 Message-Id: <20230208164643.6EE643858C50@sourceware.org> Date: Wed, 8 Feb 2023 16:46:43 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D83bad3162d73= 03b51e2ec9b49cb9e78c72d27aa3 commit 83bad3162d7303b51e2ec9b49cb9e78c72d27aa3 Author: Tom Tromey Date: Fri Jan 13 09:08:41 2023 -0700 Do not pass section index to end_compunit_symtab =20 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. Diff: --- gdb/buildsym-legacy.c | 4 ++-- gdb/buildsym-legacy.h | 3 +-- gdb/buildsym.c | 23 +++++++++-------------- gdb/buildsym.h | 9 ++++----- gdb/coffread.c | 2 +- gdb/ctfread.c | 10 ++++------ gdb/dbxread.c | 5 ++--- gdb/dwarf2/read.c | 5 ++--- gdb/mdebugread.c | 5 ++--- gdb/xcoffread.c | 12 +++++------- 10 files changed, 32 insertions(+), 46 deletions(-) diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c index e4194b69403..cb733e7101b 100644 --- a/gdb/buildsym-legacy.c +++ b/gdb/buildsym-legacy.c @@ -171,11 +171,11 @@ free_buildsym_compunit (void) } =20 struct compunit_symtab * -end_compunit_symtab (CORE_ADDR end_addr, int section) +end_compunit_symtab (CORE_ADDR end_addr) { gdb_assert (buildsym_compunit !=3D nullptr); struct compunit_symtab *result - =3D buildsym_compunit->end_compunit_symtab (end_addr, section); + =3D buildsym_compunit->end_compunit_symtab (end_addr); free_buildsym_compunit (); return result; } diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h index b553eb7e054..3d705a8beed 100644 --- a/gdb/buildsym-legacy.h +++ b/gdb/buildsym-legacy.h @@ -70,8 +70,7 @@ extern void push_subfile (); =20 extern const char *pop_subfile (); =20 -extern struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr, - int section); +extern struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr); =20 extern struct context_stack *push_context (int desc, CORE_ADDR valu); =20 diff --git a/gdb/buildsym.c b/gdb/buildsym.c index adab927235c..41df0f061c1 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -854,7 +854,7 @@ buildsym_compunit::end_compunit_symtab_get_static_block= (CORE_ADDR end_addr, =20 struct compunit_symtab * 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 =3D m_compunit_symtab; struct blockvector *blockvector; @@ -974,7 +974,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector set_block_compunit_symtab (b, cu); } =20 - cu->set_block_line_section (section); + cu->set_block_line_section (SECT_OFF_TEXT (m_objfile)); =20 cu->set_macro_table (release_macros ()); =20 @@ -1014,15 +1014,12 @@ buildsym_compunit::end_compunit_symtab_with_blockve= ctor /* Implementation of the second part of end_compunit_symtab. Pass STATIC_= BLOCK as value returned by end_compunit_symtab_get_static_block. =20 - 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 expandable. */ =20 struct compunit_symtab * 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; =20 @@ -1040,7 +1037,7 @@ buildsym_compunit::end_compunit_symtab_from_static_bl= ock cu =3D NULL; } else - cu =3D end_compunit_symtab_with_blockvector (static_block, section, ex= pandable); + cu =3D end_compunit_symtab_with_blockvector (static_block, expandable); =20 return cu; } @@ -1050,9 +1047,7 @@ buildsym_compunit::end_compunit_symtab_from_static_bl= ock them), then make the struct symtab for that file and put it in the list of all such. =20 - END_ADDR is the address of the end of the file's text. SECTION is - the section number (in objfile->section_offsets) of the blockvector - and linetable. + END_ADDR is the address of the end of the file's text. =20 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 @@ -1067,24 +1062,24 @@ buildsym_compunit::end_compunit_symtab_from_static_= block end_compunit_symtab_from_static_block yourself. */ =20 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; =20 static_block =3D 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); } =20 /* Same as end_compunit_symtab except create a symtab that can be later ad= ded to. */ =20 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; =20 static_block =3D 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); } =20 /* Subroutine of augment_type_symtab to simplify it. diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 9724607f3d9..42fcd1fdb97 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -327,12 +327,11 @@ struct buildsym_compunit (CORE_ADDR end_addr, int expandable, int required); =20 struct compunit_symtab *end_compunit_symtab_from_static_block - (struct block *static_block, int section, int expandable); + (struct block *static_block, int expandable); =20 - struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr, int sec= tion); + struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr); =20 - struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr, - int section); + struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr); =20 void augment_type_symtab (); =20 @@ -352,7 +351,7 @@ private: void watch_main_source_file_lossage (); =20 struct compunit_symtab *end_compunit_symtab_with_blockvector - (struct block *static_block, int section, int expandable); + (struct block *static_block, int expandable); =20 /* The objfile we're reading debug info from. */ struct objfile *m_objfile; diff --git a/gdb/coffread.c b/gdb/coffread.c index 8f2a8673e10..65d7828e933 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -404,7 +404,7 @@ coff_end_compunit_symtab (struct objfile *objfile) { set_last_source_start_addr (current_source_start_addr); =20 - end_compunit_symtab (current_source_end_addr, SECT_OFF_TEXT (objfile)); + end_compunit_symtab (current_source_end_addr); =20 /* Reinitialize for beginning of new file. */ set_last_source_file (NULL); diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 97a0df91a53..69906c9cb2e 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -1258,18 +1258,17 @@ ctf_start_compunit_symtab (ctf_psymtab *pst, } =20 /* Finish reading symbol/type definitions in CTF format. - END_ADDR is the end address of the file's text. SECTION is - the .text section number. */ + END_ADDR is the end address of the file's text. */ =20 static struct compunit_symtab * ctf_end_compunit_symtab (ctf_psymtab *pst, - CORE_ADDR end_addr, int section) + CORE_ADDR end_addr) { struct ctf_context *ccp; =20 ccp =3D &pst->context; struct compunit_symtab *result - =3D ccp->builder->end_compunit_symtab (end_addr, section); + =3D ccp->builder->end_compunit_symtab (end_addr); delete ccp->builder; ccp->builder =3D nullptr; return result; @@ -1411,8 +1410,7 @@ ctf_psymtab::read_symtab (struct objfile *objfile) =20 set_text_low (offset); set_text_high (offset + tsize); - compunit_symtab =3D ctf_end_compunit_symtab (this, offset + tsize, - SECT_OFF_TEXT (objfile)); + compunit_symtab =3D ctf_end_compunit_symtab (this, offset + tsize); =20 /* Finish up the debug error message. */ if (info_verbose) diff --git a/gdb/dbxread.c b/gdb/dbxread.c index dc11f0bb6a9..36e744fa61f 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2331,8 +2331,7 @@ read_ofile_symtab (struct objfile *objfile, legacy_ps= ymtab *pst) if (get_last_source_start_addr () > text_offset) set_last_source_start_addr (text_offset); =20 - pst->compunit_symtab =3D end_compunit_symtab (text_offset + text_size, - SECT_OFF_TEXT (objfile)); + pst->compunit_symtab =3D end_compunit_symtab (text_offset + text_size); =20 end_stabs (); =20 @@ -2594,7 +2593,7 @@ process_one_symbol (int type, int desc, CORE_ADDR val= u, const char *name, patch_subfile_names (get_current_subfile (), name); break; /* Ignore repeated SOs. */ } - end_compunit_symtab (valu, SECT_OFF_TEXT (objfile)); + end_compunit_symtab (valu); end_stabs (); } =20 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 8708f7a4074..fb5aa7b8e5b 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -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); =20 cust =3D cu->get_builder ()->end_compunit_symtab_from_static_block - (static_block, SECT_OFF_TEXT (objfile), 0); + (static_block, 0); =20 if (cust !=3D NULL) { @@ -8508,7 +8508,6 @@ process_full_type_unit (dwarf2_cu *cu, enum language pretend_language) { dwarf2_per_objfile *per_objfile =3D cu->per_objfile; - struct objfile *objfile =3D per_objfile->objfile; struct compunit_symtab *cust; struct signatured_type *sig_type; =20 @@ -8542,7 +8541,7 @@ process_full_type_unit (dwarf2_cu *cu, if (tug_unshare->compunit_symtab =3D=3D NULL) { buildsym_compunit *builder =3D cu->get_builder (); - cust =3D builder->end_expandable_symtab (0, SECT_OFF_TEXT (objfile)); + cust =3D builder->end_expandable_symtab (0); tug_unshare->compunit_symtab =3D cust; =20 if (cust !=3D NULL) diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 4feee39035e..609b51727aa 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -3968,7 +3968,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct ob= jfile *objfile) { valu +=3D section_offsets[SECT_OFF_TEXT (objfile)]; previous_stab_code =3D N_SO; - cust =3D end_compunit_symtab (valu, SECT_OFF_TEXT (objfile)); + cust =3D end_compunit_symtab (valu); end_stabs (); last_symtab_ended =3D 1; } @@ -4028,8 +4028,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct ob= jfile *objfile) =20 if (! last_symtab_ended) { - cust =3D end_compunit_symtab (pst->raw_text_high (), - SECT_OFF_TEXT (objfile)); + cust =3D end_compunit_symtab (pst->raw_text_high ()); end_stabs (); } =20 diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 52ae3aecb97..bd6f6521c4c 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1045,8 +1045,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_ps= ymtab *pst) { if (get_last_source_file ()) { - pst->compunit_symtab =3D end_compunit_symtab - (cur_src_end_addr, SECT_OFF_TEXT (objfile)); + pst->compunit_symtab =3D end_compunit_symtab (cur_src_end_addr); end_stabs (); } =20 @@ -1136,14 +1135,13 @@ read_xcoff_symtab (struct objfile *objfile, legacy_= psymtab *pst) { complete_symtab (filestring, file_start_addr); cur_src_end_addr =3D file_end_addr; - end_compunit_symtab (file_end_addr, - SECT_OFF_TEXT (objfile)); + end_compunit_symtab (file_end_addr); end_stabs (); start_stabs (); /* Give all csects for this source file the same name. */ start_compunit_symtab (objfile, filestring, NULL, - 0, pst_symtab_language); + 0, pst_symtab_language); record_debugformat (debugfmt); } =20 @@ -1243,7 +1241,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_ps= ymtab *pst) =20 complete_symtab (filestring, file_start_addr); cur_src_end_addr =3D file_end_addr; - end_compunit_symtab (file_end_addr, SECT_OFF_TEXT (objfile)); + end_compunit_symtab (file_end_addr); end_stabs (); =20 /* XCOFF, according to the AIX 3.2 documentation, puts the @@ -1431,7 +1429,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_ps= ymtab *pst) =20 complete_symtab (filestring, file_start_addr); cur_src_end_addr =3D file_end_addr; - cust =3D end_compunit_symtab (file_end_addr, SECT_OFF_TEXT (objfile)= ); + cust =3D end_compunit_symtab (file_end_addr); /* 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 file, not to the _globals_ symtab. I'm not sure whether this