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 AA5E73858C83 for ; Sat, 20 Aug 2022 04:49:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA5E73858C83 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1oPGQE-0007CD-CW for binutils@sourceware.org; Sat, 20 Aug 2022 06:49:22 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: binutils@sourceware.org From: Tavis Ormandy Subject: Re: making stabs visible to gdb Date: Sat, 20 Aug 2022 04:49:14 -0000 (UTC) Message-ID: References: <52303818-50b6-8525-d0c3-7399e2a1ddba@redhat.com> <87bksyg2x5.fsf@tromey.com> User-Agent: slrn/pre1.0.4-5 (Linux) X-Spam-Status: No, score=0.5 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, TIME_LIMIT_EXCEEDED, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Sat, 20 Aug 2022 04:50:55 -0000 On 2022-08-20, Tavis Ormandy via Binutils wrote: > On 2022-08-05, Tom Tromey wrote: >>>> Also, is there a better way to accomplish what I'm trying to do? >> >> In the gdb test suite, we have some Tcl code that makes it relatively >> simple to create synthetic DWARF. So, I'd consider extracting that and >> using it to describe your program. >> > > Hmm thanks, it kinda works - but it generates tons of warnings like > this: > > warning: (Internal error: pc 0x8129250 in read in psymtab, but not in > symtab.) Nevermind, I figured it out - just making sure a matching section exists that overlaps that region hides the warning. This actually works really well, I made some gas macros to make the syntax nice: .include "symbols.s" # bool rddec(char **numstr, uint16_t *num) @ 0x81dac90 function rddec, %bool, 0x81dac90 param numstr, ** %char param num, * %uint16_t It works perfectly: (gdb) add-symbol-file symbols.dbg (gdb) pt rddec type = boolean (char **, unsigned short *) (gdb) x/i rddec 0x81dac90 : push ebp (gdb) b rddec Breakpoint 1 at 0x81dac96 (gdb) r Even parameters work nicely: Breakpoint 1, 0x081dac96 in rddec (numstr=0xffffc044, num=0x8350dbe) (gdb) pt numstr type = char ** (gdb) p *numstr $1 = 0xffffc048 "06" I'm really pleased with how this turned out, thanks for the hints! Tavis. -- _o) $ lynx lock.cmpxchg8b.com /\\ _o) _o) $ finger taviso@sdf.org _\_V _( ) _( ) @taviso