From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28880 invoked by alias); 18 Oct 2016 02:27:35 -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 28859 invoked by uid 89); 18 Oct 2016 02:27:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Those, mains, Hx-languages-length:2699, our X-HELO: mailapp01.imgtec.com Received: from mailapp02.imgtec.com (HELO mailapp01.imgtec.com) (217.156.133.132) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Oct 2016 02:27:32 +0000 Received: from HHMAIL03.hh.imgtec.org (unknown [10.44.0.21]) by Forcepoint Email with ESMTPS id 0C7538977CE5D; Tue, 18 Oct 2016 03:27:28 +0100 (IST) Received: from HHMAIL01.hh.imgtec.org (10.100.10.19) by HHMAIL03.hh.imgtec.org (10.44.0.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 18 Oct 2016 03:27:29 +0100 Received: from [10.20.78.147] (10.20.78.147) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server id 14.3.294.0; Tue, 18 Oct 2016 03:27:28 +0100 Date: Tue, 18 Oct 2016 02:27:00 -0000 From: "Maciej W. Rozycki" To: Ulrich Weigand , Yao Qi CC: Subject: Re: [RFC 2/3] Record function descriptor address instead of function address in value In-Reply-To: <20161017155133.A9B8711C257@oc8523832656.ibm.com> Message-ID: References: <20161017155133.A9B8711C257@oc8523832656.ibm.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2016-10/txt/msg00498.txt.bz2 On Mon, 17 Oct 2016, Ulrich Weigand wrote: > > This patch brings several user visible changes, which look more > > accurate, shown by this table below, > > > > COMMAND BEFORE AFTER > > p main main function address main function descriptor > > address > > disass main disassembly function main not changed > > disass main+4,+4 disassembly 4 bytes from disassembly 4 bytes from > > function main address + 4 main's function descriptor + 4 > > x/i main show one instruction on show one instruction on main's > > function main address function descriptor What about `info address main'? > > Although the latter looks inconvenient, that is consistent to the > > meaning on C language level. Due to these changes, test cases are > > adjusted accordingly. > > Those are a bit annoying. I think the underlying problem is that operations > like "disass" or "x/i" really don't work on "values" in the original sense > but rather on "PC addresses". Maybe it would make sense to have those > function enable a special "mode" in the expression evaluator that would > change the conversion of functions to function pointers to use the code > address instead of the descriptor address? Agreed. I'd keep `disass main+4,+4' and `x/i main' (or `x/x main', etc., for that matter) as they are now and consistent with `disass main', if possible. These would indeed have to be special as we don't actually want to see the ISA bit set in instruction addresses in disassembly either, as they are interpreted as memory data rather than execution addresses there. For descriptor access, which may undoubtedly be useful sometimes I'd suggest using `disass &main+4,+4' and `x/i &main', which would be consistent with the interpretation of function pointers elsewhere (of course `p main' and `p &main' would roughly be equivalent). Thoughts? Overall I like the proposal and if this goes forward I will see if we can adapt the MIPS backend to use this approach as well, addressing the issues we still have remaining, such as confusing instruction addresses and wrong instruction data shown with `disass /r'. We have a little complication in that we have the ISA bit set in line information, so that would have to be stripped in DWARF record processing, but it should be much easier to do with a single hook in place than the complicated processing now required to copy ISA bit annotation from the symbol table (msymbols), the hooks to handle which we'll then be able to drop from our DWARF machinery. Thanks, Yao; also for your persistence with addressing this general issue in response to my previous critical comments! Maciej