From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 88A463858C74; Sun, 6 Feb 2022 21:08:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88A463858C74 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: add compunit_symtab::add_filetab method X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 0b17a4f78fb969e7c1ae298561ef6963c73006a7 X-Git-Newrev: 43b49762a17718fe13718238a8c0af9b62b682d4 Message-Id: <20220206210852.88A463858C74@sourceware.org> Date: Sun, 6 Feb 2022 21:08:52 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2022 21:08:52 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D43b49762a177= 18fe13718238a8c0af9b62b682d4 commit 43b49762a17718fe13718238a8c0af9b62b682d4 Author: Simon Marchi Date: Fri Nov 19 20:59:59 2021 -0500 gdb: add compunit_symtab::add_filetab method =20 Add a method to append a filetab/symtab to a compunit_symtab. There is a single place where this is done currently, in allocate_symtab. =20 Change-Id: Ie86c6e34d175728173d1cffdce44acd6cff6c31d Diff: --- gdb/symfile.c | 11 +---------- gdb/symtab.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gdb/symfile.c b/gdb/symfile.c index a660422b51e..8ec214fb8e6 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2804,16 +2804,7 @@ allocate_symtab (struct compunit_symtab *cust, const= char *filename) } =20 /* Add it to CUST's list of symtabs. */ - if (cust->filetabs =3D=3D NULL) - { - cust->filetabs =3D symtab; - cust->last_filetab =3D symtab; - } - else - { - cust->last_filetab->next =3D symtab; - cust->last_filetab =3D symtab; - } + cust->add_filetab (symtab); =20 /* Backlink to the containing compunit symtab. */ symtab->compunit_symtab =3D cust; diff --git a/gdb/symtab.h b/gdb/symtab.h index f6d787c45c8..3fa4d5f5d0e 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1459,6 +1459,20 @@ struct compunit_symtab m_objfile =3D objfile; } =20 + void add_filetab (symtab *filetab) + { + if (this->filetabs =3D=3D nullptr) + { + this->filetabs =3D filetab; + this->last_filetab =3D filetab; + } + else + { + this->last_filetab->next =3D filetab; + this->last_filetab =3D filetab; + } + } + /* Return the primary filetab of the compunit. */ symtab *primary_filetab () const;