From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20059 invoked by alias); 2 May 2019 15:56:28 -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 20040 invoked by uid 89); 2 May 2019 15:56:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=studied, nearby 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; Thu, 02 May 2019 15:56:26 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 656053001A6C; Thu, 2 May 2019 15:56:25 +0000 (UTC) Received: from f29-4.lan (ovpn-116-84.phx2.redhat.com [10.3.116.84]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D6181001E85; Thu, 2 May 2019 15:56:24 +0000 (UTC) Date: Thu, 02 May 2019 15:56:00 -0000 From: Kevin Buettner To: Eli Zaretskii Cc: gdb-patches@sourceware.org, simark@simark.ca Subject: Re: The 'cold' function attribute and GDB Message-ID: <20190502085623.35fa3ebe@f29-4.lan> In-Reply-To: <83muk4q3rr.fsf@gnu.org> References: <83wojaovbp.fsf@gnu.org> <077aee8c-7bef-bad6-a6a1-e69f116cc18b@simark.ca> <20190501195113.69aea752@f30-4.lan> <20190502003849.6759d177@f29-4.lan> <83muk4q3rr.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00042.txt.bz2 On Thu, 02 May 2019 18:23:20 +0300 Eli Zaretskii wrote: > > Date: Thu, 2 May 2019 00:38:49 -0700 > > From: Kevin Buettner > > Cc: gdb-patches@sourceware.org, Simon Marchi > > > > Can you show me what is printed for the following commands? > > > > disassemble print_vectorlike > > x/3i print_vectorlike > > b print_vectorlike > > > > For the disassemble command, I expect both ranges to be displayed. > > The x and b commands should print insns / set a breakpoint on the entry > > pc (which should NOT be the cold address) of the function. If one or more > > of these things aren't happening, then something is going wrong > > somewhere. > > Here: > > (gdb) disassemble /m print_vectorlike > Dump of assembler code for function print_vectorlike: > Address range 0x11d6521 to 0x11d81d6: > 1367 { > 0x011d6521 <+0>: push %ebp > 0x011d6522 <+1>: mov %esp,%ebp > 0x011d6524 <+3>: push %edi > 0x011d6525 <+4>: push %esi > 0x011d6526 <+5>: push %ebx > 0x011d6527 <+6>: sub $0x7c,%esp > [...] > Address range 0x12e1ce5 to 0x12e1f3b: > 1824 emacs_abort (); > 0x012e1f36 <+593>: call 0x12e7b40 > > End of assembler dump. > > (gdb) x/3i print_vectorlike > 0x11d6521 : push %ebp > 0x11d6522 : mov %esp,%ebp > 0x11d6524 : push %edi > (gdb) break print_vectorlike > Breakpoint 1 at 0x11d6521: file print.c, line 1367. > > Seems to be according to your expectations. Yes, this all looks good to me. > Btw, if I use a source line number whose code is in the 'cold' area, > then I see this: > > (gdb) break print.c:1824 > Breakpoint 1 at 0x12e1f36: file print.c, line 1824. > (gdb) info line print.c:1824 > Line 1824 of "print.c" > starts at address 0x12e1f36 > and ends at 0x12e1f3b . I'm not especially surprised that GDB chose a nearby minimal symbol to print here. I am surprised at the rather large offsets from that symbol, however. In the example that I studied last year, I think that the first offset was 0. I'll try building emacs... Kevin