From ae97bb9470f0b3e8dca46be0af6de3d671653585 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sat, 23 Apr 2016 21:38:31 +0200 Subject: [PATCH] New test for Python "Cannot locate object file for block" (for RH BZ 1325795). --- gdb-rhbz1325795-framefilters-test.patch | 158 ++++++++++++++++++++++++ gdb.spec | 9 +- 2 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 gdb-rhbz1325795-framefilters-test.patch diff --git a/gdb-rhbz1325795-framefilters-test.patch b/gdb-rhbz1325795-framefilters-test.patch new file mode 100644 index 0000000..5594e85 --- /dev/null +++ b/gdb-rhbz1325795-framefilters-test.patch @@ -0,0 +1,158 @@ +--- /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 . ++ ++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 . */ ++ ++#include ++#include ++ ++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 . ++ ++# 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() diff --git a/gdb.spec b/gdb.spec index 441b3c2..7699972 100644 --- a/gdb.spec +++ b/gdb.spec @@ -27,7 +27,7 @@ Version: 7.11 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 69%{?dist} +Release: 70%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -567,6 +567,9 @@ Patch1118: gdb-container-rh-pkg.patch # [testsuite] Fix 7.11 regression: gdb.dwarf2/dw2-undefined-ret-addr.exp Patch1120: gdb-testsuite-dw2-undefined-ret-addr.patch +# New test for Python "Cannot locate object file for block" (for RH BZ 1325795). +Patch1123: gdb-rhbz1325795-framefilters-test.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -878,6 +881,7 @@ find -name "*.info*"|xargs rm -f %patch1117 -p1 %patch1118 -p1 %patch1120 -p1 +%patch1123 -p1 %patch1075 -p1 %if 0%{?rhel:1} && 0%{?rhel} <= 7 @@ -1397,6 +1401,9 @@ then fi %changelog +* Sat Apr 23 2016 Jan Kratochvil - 7.11-70.fc24 +- New test for Python "Cannot locate object file for block" (for RH BZ 1325795). + * Tue Apr 12 2016 Jan Kratochvil - 7.11-69.fc24 - Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747).