Message ID | 20250121003809.843793-1-amerey@redhat.com |
---|---|
State | Committed |
Headers |
Return-Path: <elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6359B3858C2B for <patchwork@sourceware.org>; Tue, 21 Jan 2025 00:38:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6359B3858C2B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WoETEUsu X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id CCEC43858D28 for <elfutils-devel@sourceware.org>; Tue, 21 Jan 2025 00:38:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CCEC43858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CCEC43858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737419893; cv=none; b=mhLRQrir8WyQbNhOdC2wPvyTgPEu86u+MSGw69/Qad0b+PODyWHe0BywQM0ruDyhT83Jwoq53DbkRK4AgXDc7N0bJ/q/KxfCvMNSzEz2Erd41CYHv5EPEHJC8I9kJCyYRJqXUCZFX8iZXrc47WprsxrWCWhTTw4KbUbjo1dWkh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737419893; c=relaxed/simple; bh=HqEai823CPMDy0Q7Ev6AuPJMo9HRDF/oZLJfCtcrkow=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qGp+2jcuSgl5AG9XzTAIN4IP+fua/jO5nrFbolrf+WylAX7wXrBkxt7gXscifh3Tg1JO35RDvUTY3ySfV8A50AekW0TltCL+vidDnRyigYbIvyQJ2PbqClAg95aD2YHfRoKnhpdNOhDrjc7WfOWpeh2F7q1bghjCnlX5wR+8K6M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCEC43858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737419893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3jmEVNfzLIaEXGO1jDpgfW0EaMmIeSi/8b3xb87lwkg=; b=WoETEUsuYfEMEv5QAMyyadw/+nBRYbaM6HYODyFvy9yOPltvHunj4nQgZ2PnEqlNpPgSQe nkw1ivdmXAqLNBuJBo3a9qMOBOCzQ5jVpY4paleriNgNm9udrutCRCLhI9xaAC9FFZd24U QyxARBF0IgysN/cGjmyy3SO2JuXlZII= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-126-1bUAqLLnMYaDoTiHJVkBhg-1; Mon, 20 Jan 2025 19:38:12 -0500 X-MC-Unique: 1bUAqLLnMYaDoTiHJVkBhg-1 X-Mimecast-MFC-AGG-ID: 1bUAqLLnMYaDoTiHJVkBhg Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1F7C11955DDF for <elfutils-devel@sourceware.org>; Tue, 21 Jan 2025 00:38:11 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.80.96]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 84EFE19560BC; Tue, 21 Jan 2025 00:38:10 +0000 (UTC) From: Aaron Merey <amerey@redhat.com> To: elfutils-devel@sourceware.org Cc: Aaron Merey <amerey@redhat.com> Subject: [PATCH] libdwfl/argp-std.c: Set offline_next_address for a.out default Date: Mon, 20 Jan 2025 19:38:09 -0500 Message-ID: <20250121003809.843793-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: q9TbYq828wH8oonL-WrnPC_4iqJEm0F2BB01S3xK-Gc_1737419891 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Post: <mailto:elfutils-devel@sourceware.org> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org |
Series |
libdwfl/argp-std.c: Set offline_next_address for a.out default
|
|
Commit Message
Aaron Merey
Jan. 21, 2025, 12:38 a.m. UTC
If none of -e, -p or -k is given as a command line option, libdwfl
parse_opt will use '-e a.out' as the default.
When handling -e, parse_opt will set dwfl->offline_next_address
to 0. However when handling the default '-e a.out',
dwfl->offline_next_address is not set to 0. This can result in
eu-addr2line failing to correctly output the line information for a
given address.
Fix this by setting dwfl->offline_next_address to 0 when setting up
the default '-e a.out' dwfl.
https://sourceware.org/bugzilla/show_bug.cgi?id=32538
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
libdwfl/argp-std.c | 3 +++
1 file changed, 3 insertions(+)
Comments
Hi Aaron, On Mon, 2025-01-20 at 19:38 -0500, Aaron Merey wrote: > If none of -e, -p or -k is given as a command line option, libdwfl > parse_opt will use '-e a.out' as the default. > > When handling -e, parse_opt will set dwfl->offline_next_address > to 0. However when handling the default '-e a.out', > dwfl->offline_next_address is not set to 0. This can result in > eu-addr2line failing to correctly output the line information for a > given address. > > Fix this by setting dwfl->offline_next_address to 0 when setting up > the default '-e a.out' dwfl. Thanks, this makes sense. > --- > libdwfl/argp-std.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c > index 1605fbfe..55e98715 100644 > --- a/libdwfl/argp-std.c > +++ b/libdwfl/argp-std.c > @@ -268,6 +268,9 @@ parse_opt (int key, char *arg, struct argp_state *state) > /* Default if no -e, -p, or -k, is "-e a.out". */ > arg = "a.out"; > dwfl = INTUSE(dwfl_begin) (&offline_callbacks); > + > + if (dwfl != NULL) > + dwfl->offline_next_address = 0; > if (INTUSE(dwfl_report_offline) (dwfl, "", arg, -1) == NULL) > return fail (dwfl, -1, arg, state); > opt->dwfl = dwfl; This is indeed the same as what would happen if the user would provide "-e a.out" directly. Which has the following comment: /* Start at zero so if there is just one -e foo.so, the DSO is shown without address bias. */ dwfl->offline_next_address = 0; Cheers, Mark
On Tue, Jan 21, 2025 at 9:02 AM Mark Wielaard <mark@klomp.org> wrote: > > Hi Aaron, > > On Mon, 2025-01-20 at 19:38 -0500, Aaron Merey wrote: > > If none of -e, -p or -k is given as a command line option, libdwfl > > parse_opt will use '-e a.out' as the default. > > > > When handling -e, parse_opt will set dwfl->offline_next_address > > to 0. However when handling the default '-e a.out', > > dwfl->offline_next_address is not set to 0. This can result in > > eu-addr2line failing to correctly output the line information for a > > given address. > > > > Fix this by setting dwfl->offline_next_address to 0 when setting up > > the default '-e a.out' dwfl. > > Thanks, this makes sense. > > > --- > > libdwfl/argp-std.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c > > index 1605fbfe..55e98715 100644 > > --- a/libdwfl/argp-std.c > > +++ b/libdwfl/argp-std.c > > @@ -268,6 +268,9 @@ parse_opt (int key, char *arg, struct argp_state *state) > > /* Default if no -e, -p, or -k, is "-e a.out". */ > > arg = "a.out"; > > dwfl = INTUSE(dwfl_begin) (&offline_callbacks); > > + > > + if (dwfl != NULL) > > + dwfl->offline_next_address = 0; > > if (INTUSE(dwfl_report_offline) (dwfl, "", arg, -1) == NULL) > > return fail (dwfl, -1, arg, state); > > opt->dwfl = dwfl; > > This is indeed the same as what would happen if the user would provide > "-e a.out" directly. > > Which has the following comment: > > /* Start at zero so if there is just one -e foo.so, > the DSO is shown without address bias. */ > dwfl->offline_next_address = 0; Thanks Mark, pushed as commit 412ffac6e5a7. Aaron
diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c index 1605fbfe..55e98715 100644 --- a/libdwfl/argp-std.c +++ b/libdwfl/argp-std.c @@ -268,6 +268,9 @@ parse_opt (int key, char *arg, struct argp_state *state) /* Default if no -e, -p, or -k, is "-e a.out". */ arg = "a.out"; dwfl = INTUSE(dwfl_begin) (&offline_callbacks); + + if (dwfl != NULL) + dwfl->offline_next_address = 0; if (INTUSE(dwfl_report_offline) (dwfl, "", arg, -1) == NULL) return fail (dwfl, -1, arg, state); opt->dwfl = dwfl;