abrt/0009-ccpp-tell-gdb-to-analyze-saved-binary-image.patch
Matej Habrnal 345ed6c98e Allow rpm to be optional at build time and bug fixes
Resolves #1413637, #1413451

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
2017-01-18 10:53:54 +01:00

38 lines
1.2 KiB
Diff

From 98e5d89b5238eac954d1947de52c6b3fcf3ae987 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 29 Nov 2016 11:24:49 +0100
Subject: [PATCH] ccpp: tell gdb to analyze saved binary image
This is particularly useful when dealing with crashes in containers and
changed root environments. GDB reads the debug information from the
source elf and if the source elf is not available GDB generates useless
backtraces.
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/hooklib.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
index cb5c4cb..ccb1936 100644
--- a/src/lib/hooklib.c
+++ b/src/lib/hooklib.c
@@ -246,7 +246,13 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
if (!dd)
return NULL;
- char *executable = dd_load_text(dd, FILENAME_EXECUTABLE);
+
+ char *executable = NULL;
+ if (dd_exist(dd, FILENAME_BINARY))
+ executable = concat_path_file(dd->dd_dirname, FILENAME_BINARY);
+ else
+ executable = dd_load_text(dd, FILENAME_EXECUTABLE);
+
dd_close(dd);
/* Let user know what's going on */
--
2.9.3