From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 008493858D33 for ; Wed, 3 Aug 2022 05:11:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 008493858D33 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1oJ6fh-0008sI-4g for binutils@sourceware.org; Wed, 03 Aug 2022 07:11:53 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: binutils@sourceware.org From: Tavis Ormandy Subject: making stabs visible to gdb Date: Wed, 3 Aug 2022 05:11:46 -0000 (UTC) Message-ID: User-Agent: slrn/pre1.0.4-5 (Linux) X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NML_ADSP_CUSTOM_MED, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2022 05:11:56 -0000 Hello, I have a stripped binary I don't have the source for that I would like to debug in gdb. I thought writing some .stabs statements in gas would be a nice easy way to record the symbols I know about, like this: .equ N_FUN, 0x24 .equ N_PSYM, 0xa0 .stabs "example:f-11", N_FUN, 0, 0, 0x8005bba .stabs "foo:p*-8", N_PSYM, 0, 0, 8 .stabs "bar:p-10", N_PSYM, 0, 0, 12 https://sourceware.org/binutils/docs/as/Stab.html I think this describes a function like this at address 0x8005bba: void example(unsigned int *foo, unsigned long bar) If I assemble that (as -gstabs), then add-symbol-file a.out, gdb knows about it but won't resolve it in backtraces. (gdb) add-symbol-file a.out (gdb) info address example Symbol "example" is a function at address 0x8005bba. (gdb) pt example type = void (unsigned int *, unsigned long) (gdb) bt .. #1 0x0000000008005bba in ?? () <-- unresolved .. What am I doing wrong? Also, is there a better way to accomplish what I'm trying to do? Tavis. -- _o) $ lynx lock.cmpxchg8b.com /\\ _o) _o) $ finger taviso@sdf.org _\_V _( ) _( ) @taviso