/* Locate source files and line information for given addresses
Copyright (C) 2005-2010, 2012, 2013, 2015 Red Hat, Inc.
+ Copyright (C) 2022 Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
/* Values for the parameters which have no short form. */
#define OPT_DEMANGLER 0x100
-#define OPT_PRETTY 0x101 /* 'p' is already used to select the process. */
+#define OPT_PRETTY 0x101 /* 'p' is already used to select the process. */
+#define OPT_RELATIVE 0x102 /* 'r' is something else in binutils addr2line. */
/* Definitions of arguments for argp functions. */
static const struct argp_option options[] =
{ "addresses", 'a', NULL, 0, N_("Print address before each entry"), 0 },
{ "basenames", 's', NULL, 0, N_("Show only base names of source files"), 0 },
{ "absolute", 'A', NULL, 0,
- N_("Show absolute file names using compilation directory"), 0 },
+ N_("Show absolute file names using compilation directory (default)"), 0 },
{ "functions", 'f', NULL, 0, N_("Also show function names"), 0 },
{ "symbols", 'S', NULL, 0, N_("Also show symbol or section names"), 0 },
{ "symbols-sections", 'x', NULL, 0, N_("Also show symbol and the section names"), 0 },
N_("Show demangled symbols (ARG is always ignored)"), 0 },
{ "pretty-print", OPT_PRETTY, NULL, 0,
N_("Print all information on one line, and indent inlines"), 0 },
+ { "relative", OPT_RELATIVE, NULL, 0,
+ N_("Show relative file names without compilation directory"), 0 },
{ NULL, 0, NULL, 0, N_("Miscellaneous:"), 0 },
/* Unsupported options. */
static bool only_basenames;
/* True if absolute file names based on DW_AT_comp_dir should be shown. */
-static bool use_comp_dir;
+static bool use_comp_dir = true;
/* True if line flags should be shown. */
static bool show_flags;
use_comp_dir = true;
break;
+ case OPT_RELATIVE:
+ use_comp_dir = false;
+ break;
+
case 'f':
show_functions = true;
break;