From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106037 invoked by alias); 13 Feb 2017 12:03:11 -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 106022 invoked by uid 89); 13 Feb 2017 12:03:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=studied, H*i:sk:3269342, H*f:sk:3269342, H*MI:sk:3269342 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Feb 2017 12:03:09 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6361880F8F; Mon, 13 Feb 2017 12:03:09 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id D95CD2F6376; Mon, 13 Feb 2017 12:03:07 +0000 (UTC) Subject: Re: [PATCH V7] amd64-mpx: initialize bnd register before performing inferior calls. To: "Tedeschi, Walfred" , qiyaoltc@gmail.com, brobecker@adacore.com References: <1485875613-31975-1-git-send-email-walfred.tedeschi@intel.com> <53d42bb6-3b83-6213-4087-6d30e7d837de@redhat.com> <217a8c13-b7d0-7fe6-56b5-85ff53ce097a@intel.com> <88c7180f-8843-a148-425a-2adf56c6d0bf@redhat.com> <32693426-fbaf-8345-04c7-e2c329d6ec6e@intel.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <75843d02-1b8b-f726-c36d-cd05c0ea5339@redhat.com> Date: Mon, 13 Feb 2017 12:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <32693426-fbaf-8345-04c7-e2c329d6ec6e@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-02/txt/msg00323.txt.bz2 On 02/13/2017 08:33 AM, Tedeschi, Walfred wrote: > On 02/08/2017 01:27 PM, Pedro Alves wrote: >> For passing local pointers to some function, it might be >> that GDB could be able to figure out which bound registers >> contains the bound for a given variable, or if spilled, where >> to find then, and set up the call to use the right bounds, but >> I have no idea of how to retrieve that information. I suspect >> that it's not a mapping we could retrieve from the dwarf? And >> then there's also the case of passing pointers to global >> variables, and pointers to memory that gdb malloc's into the >> inferior, like for array/string coercion: > ABI defines which BND is used for which parameter and what to do when it > is needed to pass more bounds than BND registers available. Sure, but ABI only specifies calling convention, not whatever the compiler decides to do inside the function bodies, right? Say: extern void bar (int *ptr); void foo (int *ptr) { // lots of code code here. [...] // PTR now lives in memory, or in a different register // The corresponding BND register could have been // spilled/reused too. // do "call bar (ptr)" from the debugger while stopped here. // How would GDB determine where the correct corresponding // BND value is? } I haven't studied the BND documention in detail, but I don't imagine how the information necessary to be able to answer the question in the comment above, in the general case, could be determined from ABI-awareness alone, and I don't believe it's something that could be retrieved from DWARF either. But I'd gladly be shown wrong. > if we set afterwards: Inferior call + Break point + register set. > we should not need any additional set and show for the architecture. > Hover as you pointed out in the other e-mail it is better to increase > testing and document it. Agreed, that sounds like a reasonable way to handle that use case. I think mentioning it in the documentation would be good. Thanks, Pedro Alves