From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 352EB3858D37 for ; Fri, 5 Aug 2022 09:21:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 352EB3858D37 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-277-y72bAtWMPnKVknMAu3-Nkg-1; Fri, 05 Aug 2022 05:21:19 -0400 X-MC-Unique: y72bAtWMPnKVknMAu3-Nkg-1 Received: by mail-wm1-f70.google.com with SMTP id m4-20020a7bce04000000b003a386063752so420395wmc.1 for ; Fri, 05 Aug 2022 02:21:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=31jmdfIcLiQeY72FcdEjzCQi0UJgSxq1kPff7aOxd5Y=; b=0Nbuq3L9thv4otWvK9RshrLPrYtRqBJSYjXj1M0ThOqac4vL6jQCMgA3RBOsXxmLWJ xQjm2VupJD2LPuHDGoji0lOV5cS9dmDHsk5bT52CBeYaXHdkwrgzNT4R5wHf0NmM4WF8 QIwTO1aq5R2nNHu6DmmGifjxZcfXod+4JUfYK0qbTh/9O4Hyh+KaXLVyM2QxbHtLjzDU Cp5j4YYAfZRR8wzrNaLRgu4OCWuGKmCqCMWyBMU73B9flbgwkLwhANUkbo5bnWwgsmux rEEpTP2LNIND3PtDi+vsrF8iPyf8WS/ryHQUkdjDp3zBcXpvMDHljXTc0sso3XS5qnC2 Elkg== X-Gm-Message-State: ACgBeo2y4gMgEgFJpy9G6CjjEt+HpslnRQbMTSOU0dBdYrbbU3CokV+T pXkDSPJ5pd7/e/0jSVkUHMjp4n0VND8E/leE26x9G6HM7xtx5jGMz6ifySJ6POf/wFdI6fzOrY1 0Z/YLv3X+NaBWya56PA== X-Received: by 2002:a5d:434e:0:b0:21e:9970:fab with SMTP id u14-20020a5d434e000000b0021e99700fabmr3499798wrr.127.1659691278120; Fri, 05 Aug 2022 02:21:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR75w4H38lEl91/wHxFbh6eIebPmMkzMiv0GwHfccSHGaSlB4Vsu41Vpb80jPlJcHjqq8sSmyQ== X-Received: by 2002:a5d:434e:0:b0:21e:9970:fab with SMTP id u14-20020a5d434e000000b0021e99700fabmr3499783wrr.127.1659691277890; Fri, 05 Aug 2022 02:21:17 -0700 (PDT) Received: from [192.168.1.6] (adsl-2-solo-236-177.claranet.co.uk. [80.168.236.177]) by smtp.gmail.com with ESMTPSA id u13-20020a5d434d000000b0021e74ef5ae8sm3370767wrr.21.2022.08.05.02.21.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Aug 2022 02:21:17 -0700 (PDT) Message-ID: <52303818-50b6-8525-d0c3-7399e2a1ddba@redhat.com> Date: Fri, 5 Aug 2022 10:21:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 To: Tavis Ormandy , binutils@sourceware.org References: From: Nick Clifton Subject: Re: making stabs visible to gdb In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-GB Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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: Fri, 05 Aug 2022 09:21:22 -0000 Hi Tavis, > 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 If you assemble this and then run "objdump --debugging" on the resulting object file (or linked executable), do you get the kind of output you would expect, describing function "example" ? If not, then this would indicate that the stabs directives that you are using are wrong/incomplete. > If I assemble that (as -gstabs), then add-symbol-file a.out, gdb knows > about it but won't resolve it in backtraces. You may find that asking this question on the gdb mailing list also helps. Ie, it is possible that this is a gdb specific problem... > What am I doing wrong? My guess - you need to provide more stabs information. Are you able to compile a real C source file and capture the assembler output so that you can compare the compiler generated stabs directives to your own ? > Also, is there a better way to accomplish what I'm trying to do? I don't think so. There may be a gdb command that associates an address with a symbol name, but I do not know what it is. Sorry. Cheers Nick