From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 249753857C5D for ; Fri, 1 Oct 2021 20:56:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 249753857C5D Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 191Kuhpn011717 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 1 Oct 2021 16:56:48 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 191Kuhpn011717 Received: by simark.ca (Postfix, from userid 112) id 936101EE18; Fri, 1 Oct 2021 16:56:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 Received: from www.simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id AD5131E813; Fri, 1 Oct 2021 16:56:41 -0400 (EDT) MIME-Version: 1.0 Date: Fri, 01 Oct 2021 16:56:41 -0400 From: Simon Marchi To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 4/4] [gdb/symtab] Use unrelocated addresses in call_site In-Reply-To: <20211001123328.22314-4-tdevries@suse.de> References: <20211001123328.22314-1-tdevries@suse.de> <20211001123328.22314-4-tdevries@suse.de> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <82e1a4ada2d2fbef2b436f707c9cf435@polymtl.ca> X-Sender: simon.marchi@polymtl.ca Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 1 Oct 2021 20:56:43 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 20:56:50 -0000 On 2021-10-01 08:33, Tom de Vries via Gdb-patches wrote: > From: Simon Marchi > > Consider test-case gdb.trace/entry-values.exp with target board > unix/-fPIE/-pie. > > Using this command we have an abbreviated version, and can see the > correct > @entry values for foo: > ... > $ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \ > -ex start \ > -ex "break foo" \ > -ex "set print entry-values both" \ > -ex continue > Temporary breakpoint 1 at 0x679 > > Temporary breakpoint 1, 0x0000555555554679 in main () > Breakpoint 2 at 0x55555555463e > > Breakpoint 2, 0x000055555555463e in foo (i=0, i@entry=2, j=2, > j@entry=3) > ... > > Now, let's try the same again, but run directly to foo rather than > stopping at > main: > ... > $ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \ > -ex "break foo" \ > -ex "set print entry-values both" \ > -ex run > Breakpoint 1 at 0x63e > > Breakpoint 1, 0x000055555555463e in foo (i=0, i@entry=, > \ > j=2, j@entry=) > ... > > So, what explains the difference? Noteworthy, this is a dwarf assembly > test-case, with debug info for foo and bar, but not for main. > > In the first case: > - we run to main > - this does not trigger expanding debug info, because there's none for > main > - we set a breakpoint at foo > - this triggers expanding debug info. Relocated addresses are used in > call_site info (because the exec is started) > - we continue to foo, and manage to find the call_site info > > In the second case: > - we set a breakpoint at foo > - this triggers expanding debug info. Unrelocated addresses are used > in > call_site info (because the exec is not started) > - we run to foo > - this triggers objfile_relocate1, but it doesn't update the call_site > info addresses > - we don't manage to find the call_site info Thanks for this explanation, I had not realized the difference in behavior here. The patch LGTM. Simon