From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 261793858C50 for ; Wed, 8 Feb 2023 16:28:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 261793858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x12e.google.com with SMTP id m15so7586171ilh.9 for ; Wed, 08 Feb 2023 08:28:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=+9KowOymn7POYH6i1rLnez7Nsk5LdeVEVmGusDxxNCg=; b=hEzmeEp+bwywauR2W4008Khy8r3/mfCJmKKBao8q8m1ujScZr9RFY+h2unbst0ATe1 2f9y3n06h7E4/rgKr5BcKw1dNYqjIhjOyy4I63YykCaioHslEF/tTK2jg+p0Rxi+UFUM /B8tjRBWZJwb0V93ZEUe1rk4myG3awPujbeN+cteETPM/cqpqB2P55pRfOjbDG0LVkmy 5yGZEaIPErt8Lf1He9WxrFC7lMJA8p1ajfi6jp/3x1GSaF2QlG5uQ83Z9viTBXz347g7 QpkuCxdvPDqypW4rvHEeEEctNXBMXO/xY7bTzFDVLEeOCIrEGBQcmkBqwi5f9T6h4Nl4 cVyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+9KowOymn7POYH6i1rLnez7Nsk5LdeVEVmGusDxxNCg=; b=nY4t6gSuw+py3rzawBdCZBmP4AbtARIEDcihbXOCCuFEnZdPbGbNcJu+w9hUky1lkS MDPF6iB6imDkJX8zvZFYUitGg2xCb+H7fp+VZZCUWS/kfQhqowPPsx3pTLkHNnwe3yeY s8NEmMs/E2Okqyo6o3NsPq0+J51Ihf9ITzcWXy3Gk/XJkruzUXibuKoqrWgPdoYWuLel /Ion1Fpxcdr7VylaB+E7I/vC6fYH7akXimMA1FA+MncsuVoFmVpXodRKN25wxodJY5P+ mNQgSojK3vCtcqptQgjIpRRmPFScPlZeCBLVxaFTppD1DhOq+3bai8Ma13AJrsPCS8uH FbUw== X-Gm-Message-State: AO0yUKXvICRmFsWRofeH4Okshr8QceA4rlou/9dviFZddotS4U36h5lV wxng7gQRIvnx9Mis/m8LhGqOTQ== X-Google-Smtp-Source: AK7set9ADfPr7MaLKzrvScwP1694Gd/tfF78Un5HQfDTQyoPpCAaNc1Oy0IpXNdVWxiC6N09a/GylQ== X-Received: by 2002:a05:6e02:1906:b0:313:bb52:a979 with SMTP id w6-20020a056e02190600b00313bb52a979mr8803158ilu.17.1675873696322; Wed, 08 Feb 2023 08:28:16 -0800 (PST) Received: from murgatroyd (75-166-130-93.hlrn.qwest.net. [75.166.130.93]) by smtp.gmail.com with ESMTPSA id v11-20020a05663812cb00b003b77432cc37sm4457521jas.106.2023.02.08.08.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 08:28:15 -0800 (PST) From: Tom Tromey To: Tom Tromey via Gdb-patches Cc: Simon Marchi , Tom Tromey Subject: Re: [PATCH 3/6] Pass section index to start_compunit_symtab References: <20230118153025.342512-1-tromey@adacore.com> <20230118153025.342512-4-tromey@adacore.com> <56ff147d-d09f-2093-efac-50b1eee555d0@simark.ca> <87pmbbzekb.fsf@tromey.com> <2ae94116-fb85-ee8b-8772-4cf176a45c11@simark.ca> <87k01izlwf.fsf@tromey.com> X-Attribution: Tom Date: Wed, 08 Feb 2023 09:28:14 -0700 In-Reply-To: <87k01izlwf.fsf@tromey.com> (Tom Tromey via Gdb-patches's message of "Thu, 19 Jan 2023 06:36:32 -0700") Message-ID: <87wn4s15r5.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Tom" == Tom Tromey via Gdb-patches writes: Tom> I've updated patch #3 to just remove the section index from Tom> end_compunit_symtab, and I've added a new patch to the series to remove Tom> compunit_symtab::m_block_line_section. Here's that patch. I realized I forgot to send it to the list, but I thought I should note it here before pushing this series. Tom commit d401e7bf04c0949dcc5e3d83143b75efc19d5f1e Author: Tom Tromey Date: Thu Jan 19 06:14:49 2023 -0700 Remove compunit_symtab::m_block_line_section The previous patch hard-coded SECT_OFF_TEXT into the buildsym code. After this, it's clear that there is only one caller of compunit_symtab::set_block_line_section, and it always passes SECT_OFF_TEXT. So, remove compunit_symtab::m_block_line_section and use SECT_OFF_TEXT instead. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 41df0f061c1..d82c7672f7c 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -974,8 +974,6 @@ buildsym_compunit::end_compunit_symtab_with_blockvector set_block_compunit_symtab (b, cu); } - cu->set_block_line_section (SECT_OFF_TEXT (m_objfile)); - cu->set_macro_table (release_macros ()); /* Default any symbols without a specified symtab to the primary symtab. */ diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index fe91d609f19..236ad820462 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -718,9 +718,7 @@ call_site_target::iterate_over_addresses case call_site_target::PHYSADDR: { dwarf2_per_objfile *per_objfile = call_site->per_objfile; - compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu); - int sect_idx = cust->block_line_section (); - CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx]; + CORE_ADDR delta = per_objfile->objfile->text_section_offset (); callback (m_loc.physaddr + delta); } @@ -729,9 +727,7 @@ call_site_target::iterate_over_addresses case call_site_target::ADDRESSES: { dwarf2_per_objfile *per_objfile = call_site->per_objfile; - compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu); - int sect_idx = cust->block_line_section (); - CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx]; + CORE_ADDR delta = per_objfile->objfile->text_section_offset (); for (unsigned i = 0; i < m_loc.addresses.length; ++i) callback (m_loc.addresses.values[i] + delta); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 6a4c5976f18..45751c9c895 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -6436,9 +6436,7 @@ objfile_type (struct objfile *objfile) CORE_ADDR call_site::pc () const { - compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu); - CORE_ADDR delta - = this->per_objfile->objfile->section_offsets[cust->block_line_section ()]; + CORE_ADDR delta = this->per_objfile->objfile->text_section_offset (); return m_unrelocated_pc + delta; } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index e4fe3562c12..bf5057e723d 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -629,7 +629,7 @@ objfile_relocate1 (struct objfile *objfile, if (l) { for (int i = 0; i < l->nitems; ++i) - l->item[i].pc += delta[cust->block_line_section ()]; + l->item[i].pc += delta[SECT_OFF_TEXT (objfile)]; } } } @@ -637,7 +637,7 @@ objfile_relocate1 (struct objfile *objfile, for (compunit_symtab *cust : objfile->compunits ()) { struct blockvector *bv = cust->blockvector (); - int block_line_section = cust->block_line_section (); + int block_line_section = SECT_OFF_TEXT (objfile); if (bv->map () != nullptr) bv->map ()->relocate (delta[block_line_section]); diff --git a/gdb/symtab.c b/gdb/symtab.c index a120c1d5e15..bf3a3e3caaa 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -342,8 +342,7 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const if (m_call_site_htab == nullptr) return nullptr; - CORE_ADDR delta - = this->objfile ()->section_offsets[this->block_line_section ()]; + CORE_ADDR delta = this->objfile ()->text_section_offset (); CORE_ADDR unrelocated_pc = pc - delta; struct call_site call_site_local (unrelocated_pc, nullptr, nullptr); diff --git a/gdb/symtab.h b/gdb/symtab.h index 484644f6129..50ce7525793 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1786,16 +1786,6 @@ struct compunit_symtab m_blockvector = blockvector; } - int block_line_section () const - { - return m_block_line_section; - } - - void set_block_line_section (int block_line_section) - { - m_block_line_section = block_line_section; - } - bool locations_valid () const { return m_locations_valid; @@ -1884,10 +1874,6 @@ struct compunit_symtab all symtabs in a given compilation unit. */ struct blockvector *m_blockvector; - /* Section in objfile->section_offsets for the blockvector and - the linetable. Probably always SECT_OFF_TEXT. */ - int m_block_line_section; - /* Symtab has been compiled with both optimizations and debug info so that GDB may stop skipping prologues as variables locations are valid already at function entry points. */