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