]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl/argp-std.c: Set offline_next_address for a.out default
authorAaron Merey <amerey@redhat.com>
Tue, 21 Jan 2025 00:20:12 +0000 (19:20 -0500)
committerAaron Merey <amerey@redhat.com>
Tue, 21 Jan 2025 00:20:12 +0000 (19:20 -0500)
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

index 1605fbfeca717963c9f90638741817ddb747873d..55e98715cfb8e2d1db8339b0af3dbc803e66fed2 100644 (file)
@@ -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;