159 lines
5.7 KiB
Diff
159 lines
5.7 KiB
Diff
--- /dev/null 2016-04-19 22:52:19.405224269 +0200
|
|
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-framefilter-thread.exp 2016-04-19 23:22:10.655271756 +0200
|
|
@@ -0,0 +1,54 @@
|
|
+# Copyright (C) 2016 Free Software Foundation, Inc.
|
|
+
|
|
+# This program is free software; you can redistribute it and/or modify
|
|
+# it under the terms of the GNU General Public License as published by
|
|
+# the Free Software Foundation; either version 3 of the License, or
|
|
+# (at your option) any later version.
|
|
+#
|
|
+# This program is distributed in the hope that it will be useful,
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
+# GNU General Public License for more details.
|
|
+#
|
|
+# You should have received a copy of the GNU General Public License
|
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
+
|
|
+load_lib gdb-python.exp
|
|
+
|
|
+standard_testfile
|
|
+
|
|
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug pthreads}]} {
|
|
+ return -1
|
|
+}
|
|
+
|
|
+# Skip all tests if Python scripting is not enabled.
|
|
+if { [skip_python_tests] } { continue }
|
|
+
|
|
+if ![runto_main] then {
|
|
+ return
|
|
+}
|
|
+gdb_test_no_output "set python print-stack full" \
|
|
+ "Set python print-stack to full"
|
|
+
|
|
+# Load global frame-filters
|
|
+set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
|
|
+gdb_test_no_output "python execfile ('${remote_python_file}')" \
|
|
+ "Load python file"
|
|
+
|
|
+gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"]
|
|
+gdb_continue_to_breakpoint "Backtrace end breakpoint"
|
|
+
|
|
+# #2 0x00007ffff75f228d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M
|
|
+gdb_test "bt no-filters" " in (\\.?_*clone|thread_start) \[^\r\n\]*" "bt no-filters"
|
|
+
|
|
+# #2 0x00007ffff75f228d in 941595343737041 () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M
|
|
+# vs.
|
|
+# #2 0x00007ffff75f228d in 941595343737041Traceback (most recent call last):
|
|
+# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 145, in frame_args
|
|
+# return self._base.frame_args()
|
|
+# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 152, in frame_args
|
|
+# return args.fetch_frame_args()
|
|
+# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 276, in fetch_frame_args
|
|
+# block = self.frame.block()
|
|
+# RuntimeError: Cannot locate object file for block.
|
|
+gdb_test "bt" " in \[0-9\]+ \[^\r\n\]*" "bt with filters"
|
|
--- /dev/null 2016-04-19 22:52:19.405224269 +0200
|
|
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-framefilter-thread.c 2016-04-18 22:44:07.096613437 +0200
|
|
@@ -0,0 +1,39 @@
|
|
+/* This testcase is part of GDB, the GNU debugger.
|
|
+
|
|
+ Copyright 2016 Free Software Foundation, Inc.
|
|
+
|
|
+ This program is free software; you can redistribute it and/or modify
|
|
+ it under the terms of the GNU General Public License as published by
|
|
+ the Free Software Foundation; either version 3 of the License, or
|
|
+ (at your option) any later version.
|
|
+
|
|
+ This program is distributed in the hope that it will be useful,
|
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
+ GNU General Public License for more details.
|
|
+
|
|
+ You should have received a copy of the GNU General Public License
|
|
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
+
|
|
+#include <pthread.h>
|
|
+#include <assert.h>
|
|
+
|
|
+static void *
|
|
+start (void *arg)
|
|
+{
|
|
+ return; /* Backtrace end breakpoint */
|
|
+}
|
|
+
|
|
+int
|
|
+main (void)
|
|
+{
|
|
+ pthread_t thread1;
|
|
+ int i;
|
|
+
|
|
+ i = pthread_create (&thread1, NULL, start, NULL);
|
|
+ assert (i == 0);
|
|
+ i = pthread_join (thread1, NULL);
|
|
+ assert (i == 0);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
--- /dev/null 2016-04-19 22:52:19.405224269 +0200
|
|
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-framefilter-thread.py 2016-04-19 23:14:03.273994063 +0200
|
|
@@ -0,0 +1,56 @@
|
|
+# Copyright (C) 2016 Free Software Foundation, Inc.
|
|
+
|
|
+# This program is free software; you can redistribute it and/or modify
|
|
+# it under the terms of the GNU General Public License as published by
|
|
+# the Free Software Foundation; either version 3 of the License, or
|
|
+# (at your option) any later version.
|
|
+#
|
|
+# This program is distributed in the hope that it will be useful,
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
+# GNU General Public License for more details.
|
|
+#
|
|
+# You should have received a copy of the GNU General Public License
|
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
+
|
|
+# This file is part of the GDB testsuite. It tests Python-based
|
|
+# frame-filters.
|
|
+
|
|
+# This test is specifically crafted for RH BZ 1197665.
|
|
+
|
|
+import gdb
|
|
+import itertools
|
|
+from gdb.FrameDecorator import FrameDecorator
|
|
+import copy
|
|
+
|
|
+class Reverse_Function (FrameDecorator):
|
|
+
|
|
+ def __init__(self, fobj):
|
|
+ super(Reverse_Function, self).__init__(fobj)
|
|
+ self.fobj = fobj
|
|
+
|
|
+ def function (self):
|
|
+ # This function call should not fail.
|
|
+ gdb.target_charset ()
|
|
+
|
|
+ fname = str (self.fobj.function())
|
|
+ if (fname == None or fname == ""):
|
|
+ return None
|
|
+ else:
|
|
+ fname = fname[::-1]
|
|
+ return fname
|
|
+
|
|
+class FrameFilter ():
|
|
+
|
|
+ def __init__ (self):
|
|
+ self.name = "Reverse"
|
|
+ self.priority = 100
|
|
+ self.enabled = True
|
|
+ gdb.frame_filters [self.name] = self
|
|
+
|
|
+ def filter (self, frame_iter):
|
|
+ frame_iter = itertools.imap (Reverse_Function,
|
|
+ frame_iter)
|
|
+ return frame_iter
|
|
+
|
|
+FrameFilter()
|