|
|
f499a8 |
From 0fcd63190deeb0afa2ad04826da99e5632f9d517 Mon Sep 17 00:00:00 2001
|
|
|
f499a8 |
From: Martin Milata <mmilata@redhat.com>
|
|
|
f499a8 |
Date: Mon, 14 Jul 2014 16:53:12 +0200
|
|
|
f499a8 |
Subject: [SATYR PATCH 4/6] gdb: fix parsing of ppc64 stacktraces
|
|
|
f499a8 |
|
|
|
f499a8 |
Fixes rhbz#1119072.
|
|
|
f499a8 |
|
|
|
f499a8 |
Signed-off-by: Martin Milata <mmilata@redhat.com>
|
|
|
f499a8 |
---
|
|
|
f499a8 |
lib/gdb_frame.c | 3 +-
|
|
|
f499a8 |
tests/gdb_stacktrace.at | 35 ++++++++++++++++++++
|
|
|
f499a8 |
tests/gdb_stacktraces/rhbz-1119072 | 67 ++++++++++++++++++++++++++++++++++++++
|
|
|
f499a8 |
3 files changed, 104 insertions(+), 1 deletion(-)
|
|
|
f499a8 |
create mode 100644 tests/gdb_stacktraces/rhbz-1119072
|
|
|
f499a8 |
|
|
|
f499a8 |
diff --git a/lib/gdb_frame.c b/lib/gdb_frame.c
|
|
|
f499a8 |
index 57e9479..e449b30 100644
|
|
|
f499a8 |
--- a/lib/gdb_frame.c
|
|
|
f499a8 |
+++ b/lib/gdb_frame.c
|
|
|
f499a8 |
@@ -559,12 +559,13 @@ sr_gdb_frame_parse_function_name(const char **input,
|
|
|
f499a8 |
/* First character:
|
|
|
f499a8 |
'~' for destructor
|
|
|
f499a8 |
'*' for ????
|
|
|
f499a8 |
+ '.' on ppc64
|
|
|
f499a8 |
'_a-zA-Z' for mangled/nonmangled function name
|
|
|
f499a8 |
'(' to start "(anonymous namespace)::" or something
|
|
|
f499a8 |
*/
|
|
|
f499a8 |
char first;
|
|
|
f499a8 |
char *namechunk;
|
|
|
f499a8 |
- if (sr_parse_char_limited(&local_input, "~*_" SR_alpha, &first))
|
|
|
f499a8 |
+ if (sr_parse_char_limited(&local_input, "~*._" SR_alnum, &first))
|
|
|
f499a8 |
{
|
|
|
f499a8 |
/* If it's a start of 'o'perator, put the 'o' back! */
|
|
|
f499a8 |
if (first == 'o')
|
|
|
f499a8 |
diff --git a/tests/gdb_stacktrace.at b/tests/gdb_stacktrace.at
|
|
|
f499a8 |
index 8832cb8..f626417 100644
|
|
|
f499a8 |
--- a/tests/gdb_stacktrace.at
|
|
|
f499a8 |
+++ b/tests/gdb_stacktrace.at
|
|
|
f499a8 |
@@ -247,3 +247,38 @@ main(void)
|
|
|
f499a8 |
return 0;
|
|
|
f499a8 |
}
|
|
|
f499a8 |
]])
|
|
|
f499a8 |
+
|
|
|
f499a8 |
+## ----------------------------- ##
|
|
|
f499a8 |
+## sr_gdb_stacktrace_parse_ppc64 ##
|
|
|
f499a8 |
+## ----------------------------- ##
|
|
|
f499a8 |
+AT_TESTFUN([sr_gdb_stacktrace_parse_ppc64],
|
|
|
f499a8 |
+[[
|
|
|
f499a8 |
+#include "gdb/stacktrace.h"
|
|
|
f499a8 |
+#include "gdb/thread.h"
|
|
|
f499a8 |
+#include "gdb/frame.h"
|
|
|
f499a8 |
+#include "location.h"
|
|
|
f499a8 |
+#include "utils.h"
|
|
|
f499a8 |
+#include <assert.h>
|
|
|
f499a8 |
+#include <stdio.h>
|
|
|
f499a8 |
+
|
|
|
f499a8 |
+int
|
|
|
f499a8 |
+main(void)
|
|
|
f499a8 |
+{
|
|
|
f499a8 |
+ /* Check that satyr is able to parse backtrace with missing Thread header */
|
|
|
f499a8 |
+ struct sr_location location;
|
|
|
f499a8 |
+ sr_location_init(&location);
|
|
|
f499a8 |
+ char *error_message;
|
|
|
f499a8 |
+ char *full_input = sr_file_to_string("../../gdb_stacktraces/rhbz-1119072", &error_message);
|
|
|
f499a8 |
+ assert(full_input);
|
|
|
f499a8 |
+ char *input = full_input;
|
|
|
f499a8 |
+ struct sr_gdb_stacktrace *stacktrace = sr_gdb_stacktrace_parse(&input, &location);
|
|
|
f499a8 |
+ assert(stacktrace);
|
|
|
f499a8 |
+ assert(5 == sr_gdb_stacktrace_get_thread_count(stacktrace));
|
|
|
f499a8 |
+ struct sr_gdb_thread *thread = stacktrace->threads;
|
|
|
f499a8 |
+ assert(7 == sr_thread_frame_count(thread));
|
|
|
f499a8 |
+ struct sr_gdb_frame *frame = thread->frames;
|
|
|
f499a8 |
+ assert(0 == strcmp(frame->function_name, ".pthread_cond_timedwait"));
|
|
|
f499a8 |
+ sr_gdb_stacktrace_free(stacktrace);
|
|
|
f499a8 |
+ return 0;
|
|
|
f499a8 |
+}
|
|
|
f499a8 |
+]])
|
|
|
f499a8 |
diff --git a/tests/gdb_stacktraces/rhbz-1119072 b/tests/gdb_stacktraces/rhbz-1119072
|
|
|
f499a8 |
new file mode 100644
|
|
|
f499a8 |
index 0000000..2aca936
|
|
|
f499a8 |
--- /dev/null
|
|
|
f499a8 |
+++ b/tests/gdb_stacktraces/rhbz-1119072
|
|
|
f499a8 |
@@ -0,0 +1,67 @@
|
|
|
f499a8 |
+[New LWP 2271]
|
|
|
f499a8 |
+[New LWP 2374]
|
|
|
f499a8 |
+[New LWP 2325]
|
|
|
f499a8 |
+[New LWP 2360]
|
|
|
f499a8 |
+[New LWP 2375]
|
|
|
f499a8 |
+[Thread debugging using libthread_db enabled]
|
|
|
f499a8 |
+Using host libthread_db library "/lib64/libthread_db.so.1".
|
|
|
f499a8 |
+Core was generated by `caja '.
|
|
|
f499a8 |
+Program terminated with signal SIGTRAP, Trace/breakpoint trap.
|
|
|
f499a8 |
+#0 0x000000803a327a54 in .raise () from /usr/lib64/libpthread.so.0
|
|
|
f499a8 |
+
|
|
|
f499a8 |
+Thread 5 (Thread 0x3fffa0ebeed0 (LWP 2375)):
|
|
|
f499a8 |
+#0 0x000000803a321f24 in .pthread_cond_timedwait () from /usr/lib64/libpthread.so.0
|
|
|
f499a8 |
+#1 0x000000803a748054 in .g_cond_wait_until () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#2 0x000000803a6ac2c8 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#3 0x000000803a720530 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#4 0x000000803a71f3f8 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#5 0x000000803a31c31c in .start_thread () from /usr/lib64/libpthread.so.0
|
|
|
f499a8 |
+#6 0x000000803a20c150 in .__clone () from /usr/lib64/libc.so.6
|
|
|
f499a8 |
+
|
|
|
f499a8 |
+Thread 4 (Thread 0x3fffa208eed0 (LWP 2360)):
|
|
|
f499a8 |
+#0 0x000000803a1fd130 in .__GI___poll () from /usr/lib64/libc.so.6
|
|
|
f499a8 |
+#1 0x000000803a6fe0b0 in .g_poll () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#2 0x000000803a6e9ef4 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#3 0x000000803a6ea610 in .g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#4 0x000000803ae658c8 in 0000090f.plt_call.g_io_channel_flush+0 () from /usr/lib64/libgio-2.0.so.0
|
|
|
f499a8 |
+#5 0x000000803a71f3f8 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#6 0x000000803a31c31c in .start_thread () from /usr/lib64/libpthread.so.0
|
|
|
f499a8 |
+#7 0x000000803a20c150 in .__clone () from /usr/lib64/libc.so.6
|
|
|
f499a8 |
+
|
|
|
f499a8 |
+Thread 3 (Thread 0x3fffa288eed0 (LWP 2325)):
|
|
|
f499a8 |
+#0 0x000000803a1fd130 in .__GI___poll () from /usr/lib64/libc.so.6
|
|
|
f499a8 |
+#1 0x000000803a6fe0b0 in .g_poll () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#2 0x000000803a6e9ef4 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#3 0x000000803a6ea0a4 in .g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#4 0x00003fffa28ba8dc in 00000010.plt_call.g_hash_table_size+0 () from /usr/lib64/gio/modules/libdconfsettings.so
|
|
|
f499a8 |
+#5 0x000000803a71f3f8 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#6 0x000000803a31c31c in .start_thread () from /usr/lib64/libpthread.so.0
|
|
|
f499a8 |
+#7 0x000000803a20c150 in .__clone () from /usr/lib64/libc.so.6
|
|
|
f499a8 |
+
|
|
|
f499a8 |
+Thread 2 (Thread 0x3fffa16beed0 (LWP 2374)):
|
|
|
f499a8 |
+#0 0x000000803a1fd130 in .__GI___poll () from /usr/lib64/libc.so.6
|
|
|
f499a8 |
+#1 0x000000803a6fe0b0 in .g_poll () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#2 0x000000803a6e9ef4 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#3 0x000000803a6ea0a4 in .g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#4 0x000000803a6ea15c in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#5 0x000000803a71f3f8 in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#6 0x000000803a31c31c in .start_thread () from /usr/lib64/libpthread.so.0
|
|
|
f499a8 |
+#7 0x000000803a20c150 in .__clone () from /usr/lib64/libc.so.6
|
|
|
f499a8 |
+
|
|
|
f499a8 |
+Thread 1 (Thread 0x3fffa9210490 (LWP 2271)):
|
|
|
f499a8 |
+#0 0x000000803a327a54 in .raise () from /usr/lib64/libpthread.so.0
|
|
|
f499a8 |
+#1 0x000000803a6f3dd8 in .g_logv () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#2 0x000000803a6f3ef8 in .g_log () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#3 0x000000803cd0c230 in 000002cd.plt_call.XmbTextExtents+0 () from /usr/lib64/libgdk-x11-2.0.so.0
|
|
|
f499a8 |
+#4 0x000000803a9e0870 in ._XError () from /usr/lib64/libX11.so.6
|
|
|
f499a8 |
+#5 0x000000803a9dc398 in 00000e9e.plt_call._XimXTransGetHostname+0 () from /usr/lib64/libX11.so.6
|
|
|
f499a8 |
+#6 0x000000803a9dc514 in 00000e9e.plt_call._XimXTransGetHostname+0 () from /usr/lib64/libX11.so.6
|
|
|
f499a8 |
+#7 0x000000803a9dd19c in ._XEventsQueued () from /usr/lib64/libX11.so.6
|
|
|
f499a8 |
+#8 0x000000803a9c8d6c in .XPending () from /usr/lib64/libX11.so.6
|
|
|
f499a8 |
+#9 0x000000803ccfbd74 in 000002cd.plt_call.XmbTextExtents+0 () from /usr/lib64/libgdk-x11-2.0.so.0
|
|
|
f499a8 |
+#10 0x000000803ccfbf58 in 000002cd.plt_call.XmbTextExtents+0 () from /usr/lib64/libgdk-x11-2.0.so.0
|
|
|
f499a8 |
+#11 0x000000803a6e9124 in .g_main_context_prepare () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#12 0x000000803a6e9d7c in 000000ca.plt_call.strncasecmp@@GLIBC_2.3+0 () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#13 0x000000803a6ea610 in .g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
|
|
|
f499a8 |
+#14 0x000000803c839050 in .gtk_main () from /usr/lib64/libgtk-x11-2.0.so.0
|
|
|
f499a8 |
+#15 0x0000000010051054 in .main ()
|
|
|
f499a8 |
--
|
|
|
f499a8 |
1.9.3
|
|
|
f499a8 |
|