doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

Blame SOURCES/0009-lib-Correct-the-syntax-for-gdb-backtrace-command.patch

e0b939
From 7e9e07dc9ce67777a201beddc8cef32f08293a2b Mon Sep 17 00:00:00 2001
e0b939
From: Martin Kutlak <mkutlak@redhat.com>
e0b939
Date: Tue, 24 Jul 2018 10:17:05 +0200
e0b939
Subject: [PATCH] lib: Correct the syntax for gdb backtrace command
e0b939
e0b939
abrt-action-generate-backtrace generates backtraces with error message:
e0b939
A syntax error in expression, near `full'.
e0b939
e0b939
According to the GDB documentation the correct syntax for backtrace
e0b939
command is:
e0b939
backtrace [n]
e0b939
backtrace full [n]
e0b939
e0b939
- sourceware.org/gdb/onlinedocs/gdb/Backtrace.html
e0b939
e0b939
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
e0b939
---
e0b939
 src/lib/hooklib.c | 4 ++--
e0b939
 1 file changed, 2 insertions(+), 2 deletions(-)
e0b939
e0b939
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
e0b939
index 135c7cde..b66fc119 100644
e0b939
--- a/src/lib/hooklib.c
e0b939
+++ b/src/lib/hooklib.c
e0b939
@@ -353,11 +353,11 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
e0b939
     /* Limit bt depth. With no limit, gdb sometimes OOMs the machine */
e0b939
     unsigned bt_depth = 1024;
e0b939
     const char *thread_apply_all = "thread apply all -ascending";
e0b939
-    const char *full = " full";
e0b939
+    const char *full = "full ";
e0b939
     char *bt = NULL;
e0b939
     while (1)
e0b939
     {
e0b939
-        args[bt_cmd_index] = xasprintf("%s backtrace %u%s", thread_apply_all, bt_depth, full);
e0b939
+        args[bt_cmd_index] = xasprintf("%s backtrace %s%u", thread_apply_all, full, bt_depth);
e0b939
         bt = exec_vp(args, /*redirect_stderr:*/ 1, timeout_sec, NULL);
e0b939
         free(args[bt_cmd_index]);
e0b939
         if ((bt && strnlen(bt, 256*1024) < 256*1024) || bt_depth <= 32)
e0b939
-- 
e0b939
2.17.2
e0b939