From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50288 invoked by alias); 11 Feb 2020 10:40:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 50276 invoked by uid 89); 11 Feb 2020 10:40:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-wm1-f68.google.com Received: from mail-wm1-f68.google.com (HELO mail-wm1-f68.google.com) (209.85.128.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 10:40:16 +0000 Received: by mail-wm1-f68.google.com with SMTP id t14so2851472wmi.5 for ; Tue, 11 Feb 2020 02:40:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=4xzG8KaaL86FYEsd5SYSkgNo/objeDu3kymCWdIoGdo=; b=gbVNv4FcXtHVlWQ1ps/DF8U4BsYLwelPeAyrgECx7FC5mnKsiy4w1OXgb2oxrFoGYD XCKJf0oTySSC3SrLPtudUycULf2MHyOQ3xabA2quavXi1rIrOGYpkEw7KIgoXDY3hhYu 0b9EtwJvNDgVFeO4BkGgIkhmp2oqL6wCvrCGbh51C3bwq557g/VgYD8pzCkHJdBUckYV WT3P6IC3tLKD6MCkeo7+CRjj94RwwF2yQh+fX1nPHQBgUjvEY0YJ8YitiPrXy/HYIB9v 7tTlNpgpd3lRlVtJCdRe9guVoNCi6mgRVLxqsFio5Zuy74zgUoi1eRMLn67NbGx9i57I 2F9Q== Return-Path: Received: from [172.29.6.113] (26.124.146.82.ipv4.evonet.be. [82.146.124.26]) by smtp.gmail.com with ESMTPSA id r6sm4726586wrq.92.2020.02.11.02.40.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Feb 2020 02:40:13 -0800 (PST) Subject: Re: [PATCH 7/8] Remove the objfile backlink from comp_unit To: Tom Tromey , gdb-patches@sourceware.org References: <20200208152758.29385-1-tom@tromey.com> <20200208152758.29385-8-tom@tromey.com> From: Luis Machado Message-ID: <9a55899f-7755-973f-5dd4-3beaae6f3624@linaro.org> Date: Tue, 11 Feb 2020 10:40:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200208152758.29385-8-tom@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00376.txt.bz2 On 2/8/20 12:27 PM, Tom Tromey wrote: > This removes the objfile backlink from comp_unit. The only remaining > uses involved fetching the text offset from the objfile. However, > this is already convenient computed at all the sites that call > execute_cfa_program, and so it can simply be passed in. > > gdb/ChangeLog > 2020-02-08 Tom Tromey > > * dwarf2/frame.c (struct comp_unit) : Remove. > (execute_cfa_program): Add text_offset parameter. > (execute_cfa_program_test, dwarf2_fetch_cfa_info) > (dwarf2_frame_cache): Update. > (dwarf2_build_frame_info): Don't set "objfile" member. > > Change-Id: I81b1c82d514dad83b3d00053756a07ef54b19796 > --- > gdb/ChangeLog | 8 ++++++++ > gdb/dwarf2/frame.c | 25 +++++++++++++------------ > 2 files changed, 21 insertions(+), 12 deletions(-) > > diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c > index d4f6165b75c..2c35016e2d9 100644 > --- a/gdb/dwarf2/frame.c > +++ b/gdb/dwarf2/frame.c > @@ -139,8 +139,6 @@ struct comp_unit > /* Keep the bfd convenient. */ > bfd *abfd = nullptr; > > - struct objfile *objfile = nullptr; > - > /* Pointer to the .debug_frame section loaded into memory. */ > const gdb_byte *dwarf_frame_buffer = nullptr; > > @@ -349,7 +347,8 @@ Not implemented: computing unwound register using explicit value operator")); > static const gdb_byte * > execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr, > const gdb_byte *insn_end, struct gdbarch *gdbarch, > - CORE_ADDR pc, struct dwarf2_frame_state *fs) > + CORE_ADDR pc, struct dwarf2_frame_state *fs, > + CORE_ADDR text_offset) > { > int eh_frame_p = fde->eh_frame_p; > unsigned int bytes_read; > @@ -386,8 +385,8 @@ execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr, > fs->pc = read_encoded_value (fde->cie->unit, fde->cie->encoding, > fde->cie->ptr_size, insn_ptr, > &bytes_read, fde->initial_location); > - /* Apply the objfile offset for relocatable objects. */ > - fs->pc += fde->cie->unit->objfile->text_section_offset (); > + /* Apply the text offset for relocatable objects. */ > + fs->pc += text_offset; > insn_ptr += bytes_read; > break; > > @@ -646,7 +645,7 @@ execute_cfa_program_test (struct gdbarch *gdbarch) > > const gdb_byte *insn_end = insns + sizeof (insns); > const gdb_byte *out = execute_cfa_program (&fde, insns, insn_end, gdbarch, > - 0, &fs); > + 0, &fs, 0); > > SELF_CHECK (out == insn_end); > SELF_CHECK (fs.pc == 0); > @@ -894,13 +893,14 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc, > > /* First decode all the insns in the CIE. */ > execute_cfa_program (fde, fde->cie->initial_instructions, > - fde->cie->end, gdbarch, pc, &fs); > + fde->cie->end, gdbarch, pc, &fs, text_offset); > > /* Save the initialized register set. */ > fs.initial = fs.regs; > > /* Then decode the insns in the FDE up to our target PC. */ > - execute_cfa_program (fde, fde->instructions, fde->end, gdbarch, pc, &fs); > + execute_cfa_program (fde, fde->instructions, fde->end, gdbarch, pc, &fs, > + text_offset); > > /* Calculate the CFA. */ > switch (fs.regs.cfa_how) > @@ -1022,7 +1022,8 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache) > /* First decode all the insns in the CIE. */ > execute_cfa_program (fde, fde->cie->initial_instructions, > fde->cie->end, gdbarch, > - get_frame_address_in_block (this_frame), &fs); > + get_frame_address_in_block (this_frame), &fs, > + cache->text_offset); > > /* Save the initialized register set. */ > fs.initial = fs.regs; > @@ -1037,7 +1038,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache) > { > /* Decode the insns in the FDE up to the entry PC. */ > instr = execute_cfa_program (fde, fde->instructions, fde->end, gdbarch, > - entry_pc, &fs); > + entry_pc, &fs, cache->text_offset); > > if (fs.regs.cfa_how == CFA_REG_OFFSET > && (dwarf_reg_to_regnum (gdbarch, fs.regs.cfa_reg) > @@ -1052,7 +1053,8 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache) > > /* Then decode the insns in the FDE up to our target PC. */ > execute_cfa_program (fde, instr, fde->end, gdbarch, > - get_frame_address_in_block (this_frame), &fs); > + get_frame_address_in_block (this_frame), &fs, > + cache->text_offset); > > try > { > @@ -2135,7 +2137,6 @@ dwarf2_build_frame_info (struct objfile *objfile) > /* Build a minimal decoding of the DWARF2 compilation unit. */ > unit = new comp_unit; > unit->abfd = objfile->obfd; > - unit->objfile = objfile; > > if (objfile->separate_debug_objfile_backlink == NULL) > { > LGTM