From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55474 invoked by alias); 7 Feb 2020 03:32:23 -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 55466 invoked by uid 89); 7 Feb 2020 03:32:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=Tambe, tambe, Incorrect X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Feb 2020 03:32:21 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 167361E56E; Thu, 6 Feb 2020 22:32:20 -0500 (EST) Subject: Re: Incorrect symbol name displayed in backtrace To: William Tambe , gdb@sourceware.org References: From: Simon Marchi Message-ID: <6b7c07bc-c461-ee85-51bb-b47478dfde03@simark.ca> Date: Fri, 07 Feb 2020 03:32:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-02/txt/msg00025.txt.bz2 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? It's hard to tell without seeing the actual binary, so this is just a guess. Simon