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