This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCHv2 2/2] eu-stack: add support for sysroot option
- From: Luke Diamand <ldiamand at roku dot com>
- To: "elfutils-devel at sourceware dot org" <elfutils-devel at sourceware dot org>
- Cc: Mark Wielaard <mark at klomp dot org>, "Dmitry V. Levin" <ldv at altlinux dot org>, Luke Diamand <ldiamand at roku dot com>
- Date: Tue, 22 Jan 2019 10:16:26 +0000
- Subject: [PATCHv2 2/2] eu-stack: add support for sysroot option
- Accept-language: en-GB, en-US
- References: <20190122101610.5301-1-ldiamand@roku.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Use the dwfl_set_sysroot() function to set the sysroot to be
used when analysing a core:
e.g.
$ eu-stack --core core --sysroot /path/to/sysroot -e crashing_prog
Signed-off-by: Luke Diamand <ldiamand@roku.com>
---
src/stack.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/stack.c b/src/stack.c
index c5f347e1..5a58cc1b 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -73,6 +73,7 @@ static int core_fd = -1;
static Elf *core = NULL;
static const char *exec = NULL;
static char *debuginfo_path = NULL;
+static const char *sysroot = NULL;
static const Dwfl_Callbacks proc_callbacks =
{
@@ -554,6 +555,10 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
show_modules = true;
break;
+ case 'S':
+ sysroot = arg;
+ break;
+
case ARGP_KEY_END:
if (core == NULL && exec != NULL)
argp_error (state,
@@ -587,6 +592,8 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
dwfl = dwfl_begin (&core_callbacks);
if (dwfl == NULL)
error (EXIT_BAD, 0, "dwfl_begin: %s", dwfl_errmsg (-1));
+ if (sysroot)
+ dwfl_set_sysroot(dwfl, sysroot);
if (dwfl_core_file_report (dwfl, core, exec) < 0)
error (EXIT_BAD, 0, "dwfl_core_file_report: %s", dwfl_errmsg (-1));
}
@@ -670,6 +677,8 @@ main (int argc, char **argv)
N_("Show at most MAXFRAMES per thread (default 256, use 0 for unlimited)"), 0 },
{ "list-modules", 'l', NULL, 0,
N_("Show module memory map with build-id, elf and debug files detected"), 0 },
+ { "sysroot", 'S', "sysroot", 0,
+ N_("Set the sysroot to search for libraries referenced from the core file"), 0 },
{ NULL, 0, NULL, 0, NULL, 0 }
};
--
2.20.1