From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 623333858C2C; Thu, 24 Mar 2022 14:25:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 623333858C2C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: remove gdb.python/pretty-print-call-by-hand.exp X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: e961c696dcb226d5b58bd8b17b1cf5491d87f846 X-Git-Newrev: ba7789a316f78e163f03f9206a61d34652f7e060 Message-Id: <20220324142520.623333858C2C@sourceware.org> Date: Thu, 24 Mar 2022 14:25:20 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2022 14:25:20 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dba7789a316f7= 8e163f03f9206a61d34652f7e060 commit ba7789a316f78e163f03f9206a61d34652f7e060 Author: Simon Marchi Date: Thu Mar 24 10:21:10 2022 -0400 gdb/testsuite: remove gdb.python/pretty-print-call-by-hand.exp =20 This test was added without a corresponding fix, with some setup_kfails. However, it results in UNRESOLVED results when GDB is built with ASan. =20 ERROR: GDB process no longer exists GDB process exited with wait status 1946871 exp7 0 1 UNRESOLVED: gdb.python/pretty-print-call-by-hand.exp: frame print: ba= cktrace test (PRMS gdb/28856) =20 Remove the test from the tree, I'll attach it to the Bugzilla bug instead [1]. =20 [1] https://sourceware.org/bugzilla/show_bug.cgi?id=3D28856 =20 Change-Id: Id95d8949fb8742874bd12aeac758aa4d7564d678 Diff: --- .../gdb.python/pretty-print-call-by-hand.c | 53 --------- .../gdb.python/pretty-print-call-by-hand.exp | 127 -----------------= ---- .../gdb.python/pretty-print-call-by-hand.py | 45 -------- 3 files changed, 225 deletions(-) diff --git a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.c b/gdb/tes= tsuite/gdb.python/pretty-print-call-by-hand.c deleted file mode 100644 index 3be5675b096..00000000000 --- a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.c +++ /dev/null @@ -1,53 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2022 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 . = */ - -struct mytype -{ - char *x; -}; - -void -rec (int i) -{ - if (i <=3D 0) - return; - rec (i-1); -} - -int -f () -{ - rec (100); - return 2; -} - -void -g (struct mytype mt, int depth) -{ - if (depth <=3D 0) - return; /* TAG: final frame */ - g (mt, depth - 1); /* TAG: first frame */ -} - -int -main () -{ - struct mytype mt; - mt.x =3D "hello world"; - g (mt, 10); /* TAG: outside the frame */ - return 0; -} diff --git a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp b/gdb/t= estsuite/gdb.python/pretty-print-call-by-hand.exp deleted file mode 100644 index 0a6d014cf12..00000000000 --- a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright (C) 2022 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 a pretty printer that -# calls an inferior function by hand, triggering a Use-after-Free bug -# (PR gdb/28856). - -load_lib gdb-python.exp - -standard_testfile - -# gdb needs to be started here for skip_python_tests to work. -# prepare_for_testing could be used instead, but it could compile the prog= ram -# unnecessarily, so starting GDB like this is preferable. -gdb_start - -# Skip all tests if Python scripting is not enabled. -if { [skip_python_tests] } { continue } - -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { - untested "failed to compile" - return -1 -} - -# This proc restarts GDB, makes the inferior reach the desired spot - mark= ed -# by a comment in the .c file - and turns on the pretty printer for testin= g. -# Starting with a new GDB is important because the test may crash GDB. The -# return values are here to avoid us trying to test the pretty printer if -# there was a problem getting to main. -proc start_test { breakpoint_comment } { - global srcdir subdir testfile binfile - - # Start with a fresh gdb. - # This is important because the test can crash GDB. - - clean_restart ${binfile} - - if { ![runto_main] } then { - untested "couldn't run to breakpoint" - return -1 - } - - # Let GDB get to the return line. - gdb_breakpoint [gdb_get_line_number ${breakpoint_comment} ${testfile}.= c ] - gdb_continue_to_breakpoint ${breakpoint_comment} ".*" - - gdb_test_no_output "set print pretty on" "starting to pretty print" - - set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/$= {testfile}.py] - gdb_test_no_output "source ${remote_python_file}" "load python file" - - return 0 -} - -# Testing the backtrace command. -with_test_prefix "frame print" { - if { [start_test "TAG: final frame"] =3D=3D 0 } { - setup_kfail gdb/28856 "*-*-*" - gdb_test "backtrace -frame-arguments all" [multi_line \ - "#0 .*g \\(mt=3Dmytype is .*\\).*"\ - "#1 .*g \\(mt=3Dmytype is .*\\).*"\ - "#2 .*g \\(mt=3Dmytype is .*\\).*"\ - "#3 .*g \\(mt=3Dmytype is .*\\).*"\ - "#4 .*g \\(mt=3Dmytype is .*\\).*"\ - "#5 .*g \\(mt=3Dmytype is .*\\).*"\ - "#6 .*g \\(mt=3Dmytype is .*\\).*"\ - "#7 .*g \\(mt=3Dmytype is .*\\).*"\ - "#8 .*g \\(mt=3Dmytype is .*\\).*"\ - "#9 .*g \\(mt=3Dmytype is .*\\).*"\ - "#10 .*g \\(mt=3Dmytype is .*\\).*"\ - "#11 .*main \\(\\).*"] \ - "backtrace test" - } -} -# Testing the down command. -with_test_prefix "frame movement down" { - if { [start_test "TAG: first frame"] =3D=3D 0 } { - gdb_test "up" [multi_line "#1 .*in main \\(\\) at .*" ".*outside the fram= e.*"] - setup_kfail gdb/28856 "*-*-*" - gdb_test "down" [multi_line "#0\\s+g \\(mt=3Dmytype is .*\\).*" ".*first = frame.*"] - } -} - -# Testing the up command. -with_test_prefix "frame movement up" { - if { [start_test "TAG: final frame"] =3D=3D 0 } { - setup_kfail gdb/28856 "*-*-*" - gdb_test "up" [multi_line "#1 .*in g \\(mt=3Dmytype is .*\\).*" ".*first = frame.*"] - } -} - -# Testing the finish command. -with_test_prefix "frame exit through finish" { - if { [start_test "TAG: final frame"] =3D=3D 0 } { - setup_kfail gdb/28856 "*-*-*" - gdb_test "finish" [multi_line "Run till exit from #0 .*" ".* g \\(mt=3Dmy= type is .*\\, depth=3D1\\).*" ".*first frame.*"] - } -} - -# Testing the step command. -with_test_prefix "frame enter through step" { - if { [start_test "TAG: outside the frame"] =3D=3D 0 } { - setup_kfail gdb/28856 "*-*-*" - gdb_test "step" [multi_line "g \\(mt=3Dmytype is .*\\, depth=3D10\\).*" "= 41.*if \\(depth \\<=3D 0\\)"] - } -} - -# Testing the continue command. -with_test_prefix "frame enter through continue" { - if { [start_test "TAG: outside the frame"] =3D=3D 0 } { - setup_kfail gdb/28856 "*-*-*" - gdb_breakpoint [gdb_get_line_number "TAG: first frame" ${testfile}.c ] - gdb_continue_to_breakpoint "TAG: first frame" ".*TAG: first frame.*" - } -} diff --git a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.py b/gdb/te= stsuite/gdb.python/pretty-print-call-by-hand.py deleted file mode 100644 index 5343af831a7..00000000000 --- a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2022 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 . - - -class MytypePrinter: - """pretty print my type""" - - def __init__(self, val): - self.val =3D val - - def to_string(self): - calls =3D gdb.parse_and_eval("f()") - return "mytype is %s" % self.val["x"] - - -def ec_lookup_function(val): - typ =3D val.type - if typ.code =3D=3D gdb.TYPE_CODE_REF: - typ =3D typ.target() - if str(typ) =3D=3D "struct mytype": - return MytypePrinter(val) - return None - - -def disable_lookup_function(): - ec_lookup_function.enabled =3D False - - -def enable_lookup_function(): - ec_lookup_function.enabled =3D True - - -gdb.pretty_printers.append(ec_lookup_function)