From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75636 invoked by alias); 24 Mar 2018 03:40:31 -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 75624 invoked by uid 89); 24 Mar 2018 03:40:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=alt X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 24 Mar 2018 03:40:29 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 809E71E4AE; Fri, 23 Mar 2018 23:40:27 -0400 (EDT) Subject: Re: [RFA 1/2] Make line tables independent of progspace To: Tom Tromey , gdb-patches@sourceware.org Cc: Tom Tromey References: <20180321171809.13115-1-tom@tromey.com> <20180321171809.13115-2-tom@tromey.com> From: Simon Marchi Message-ID: Date: Sat, 24 Mar 2018 03:40:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180321171809.13115-2-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-03/txt/msg00476.txt.bz2 Hi Tom, I haven't looked at in details, but I just have one comment for now: On 2018-03-21 01:18 PM, Tom Tromey wrote: > diff --git a/gdb/symtab.h b/gdb/symtab.h > index f9d52e7697..2b3d8018a7 100644 > --- a/gdb/symtab.h > +++ b/gdb/symtab.h > @@ -1228,9 +1228,23 @@ struct rust_vtable_symbol : public symbol > struct linetable_entry > { > int line; > - CORE_ADDR pc; > + > + /* Note that the PC as stored is unrelocated. The appropriate > + offset must be applied before it can be used. */ > + CORE_ADDR m_pc; > }; > > +#define SET_LINETABLE_ENTRY_ADDRESS(ENTRY, PC) \ > + ((ENTRY).m_pc = (PC)) > +#define LINETABLE_ENTRY_RAW_ADDRESS(ENTRY) \ > + ((ENTRY).m_pc + 0) > +#define LINETABLE_ENTRY_ADDRESS(SYMTAB, ENTRY) \ > + gdbarch_addr_bits_remove \ > + (get_objfile_arch (SYMTAB_OBJFILE (SYMTAB)), \ > + ((ENTRY).m_pc \ > + + ANOFFSET (SYMTAB_OBJFILE (SYMTAB)->section_offsets, \ > + SYMTAB_COMPUNIT (SYMTAB)->block_line_section))) Is it possible to make these functions instead of macros? They could even be made into methods of struct linetable_entry without making the structure non-pod. I think it would also make the code more readable: LINETABLE_ENTRY_RAW_ADDRESS (e) SET_LINETABLE_ENTRY_ADDRESS (e, pc); LINETABLE_ENTRY_ADDRESS (s, e) vs e.raw_address () e.set_address (pc) e.address (s) I think it makes a good difference in terms of readability in those big ifs: if (LINETABLE_ENTRY_ADDRESS (iter_s, *item) > pc && (!alt || (LINETABLE_ENTRY_ADDRESS (iter_s, *item) < LINETABLE_ENTRY_ADDRESS (alt_symtab, *alt)))) Simon