From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99479 invoked by alias); 7 Feb 2020 03:56:12 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 99384 invoked by uid 89); 7 Feb 2020 03:56:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=H*i:sk:6b7c07b, H*f:sk:6b7c07b X-HELO: mail-lj1-f175.google.com Received: from mail-lj1-f175.google.com (HELO mail-lj1-f175.google.com) (209.85.208.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Feb 2020 03:56:07 +0000 Received: by mail-lj1-f175.google.com with SMTP id y6so618155lji.0 for ; Thu, 06 Feb 2020 19:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1GUDH8KgRyBmm8Zdb3EGzC1cEqnCWLZr9TloUtBSE2U=; b=BbOnEy3s+k7qHFny0BdM8jczl3tz0Oj9+DGr2pc/lMKuIhbUonSAatEXp/Q40BSGKa tzWBr9o5m+5/4tE9Avkq/nY1PiUt+t8/1x96iDmzQebKPaRjFMm3rjZGg3Fbn/i0qOi5 68QZvVBtKd+0l5cdgj+jmfzhT5cHaQclEiirP/eWo5ORWa/8v8djUT7JJaqX7m2ChL4t 0p6szCWlUTVnwMH0tKVFapR6RRU94zuP+i/HIJ6wfN1IDKqdafvH/W75XdzXWRbzIuU9 BkHYxQMpus1RHpwL0RKHVgh5DWLXJLt9myEoucMTCFCzGlHE8ruVimRTV851qXI7qAI6 PrFQ== MIME-Version: 1.0 References: <6b7c07bc-c461-ee85-51bb-b47478dfde03@simark.ca> In-Reply-To: <6b7c07bc-c461-ee85-51bb-b47478dfde03@simark.ca> From: William Tambe Date: Fri, 07 Feb 2020 03:56:00 -0000 Message-ID: Subject: Re: Incorrect symbol name displayed in backtrace To: Simon Marchi Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2020-02/txt/msg00026.txt.bz2 On Thu, Feb 6, 2020 at 10:32 PM Simon Marchi wrote: > > On 2020-02-05 11:36 p.m., William Tambe wrote: > > Below is an example of backtrace where I find that GDB printed a > > symbol name that is not found at the address shown in the backtrace. > > In the example below, GDB says that __kprobes_text_start() is at > > 0x0039f000, however when I used p (void *)0x0039f000, it prints the > > correct symbol name at 0x0039f000. > > > > (gdb) bt > > #0 0x05000100 in _start () > > #1 0x0039f000 in __kprobes_text_start () > > Backtrace stopped: frame did not save the PC > > (gdb) p (void *)0x0039f000 > > $6 = (void *) 0x39f000 <__tramp_exit> > > > > > > Any idea what is the difference in the way symbol names are printed in > > the backtrace and by the command "p" ? > > The only reason I could imagine is that for the backtrace, GDB looks for > the closest code symbol, whereas with the print command, it looks for > any kind of symbol. And perhaps that in this case, __kprobes_text_start > is a code symbol whereas __tramp_exit is a data symbol. > > Note that when GDB says: > > #1 0x0039f000 in __kprobes_text_start () > > It doesn't mean that __kprobes_text_start == 0x0039f000, it's just that for > all it knows, the current address (0x0039f000) is in the function > __kprobes_text_start. What does "print __kprobes_text_start" say? (gdb) p __kprobes_text_start $22 = 0x39eda8 <__kprobes_text_start> "" __kprobes_text_start is not a function; it is declared as follow: extern char __kprobes_text_start[] > > It's hard to tell without seeing the actual binary, so this is just a guess. Is it possible to have pointers in the code where symbol names are printed for the backtrace and where they are printed for the command "p" ? > > Simon