From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18796 invoked by alias); 17 Aug 2010 21:32:00 -0000 Received: (qmail 18786 invoked by uid 22791); 17 Aug 2010 21:32:00 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Aug 2010 21:31:53 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7HLVqsd031567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Aug 2010 17:31:52 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7HLVnKt016634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Aug 2010 17:31:51 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o7HLVnMf020973; Tue, 17 Aug 2010 23:31:49 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o7HLVnna020972; Tue, 17 Aug 2010 23:31:49 +0200 Date: Tue, 17 Aug 2010 21:32:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [patch] testsuite: new: std::terminate crash Message-ID: <20100817213149.GA20897@host1.dyn.jankratochvil.net> References: <20100817183802.GA28129@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00281.txt.bz2 On Tue, 17 Aug 2010 21:06:02 +0200, Tom Tromey wrote: > Ok. Checked-in. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2010-08/msg00090.html --- src/gdb/testsuite/ChangeLog 2010/08/17 20:59:03 1.2412 +++ src/gdb/testsuite/ChangeLog 2010/08/17 21:31:12 1.2413 @@ -1,4 +1,10 @@ 2010-08-17 Jan Kratochvil + + * gdb.cp/infcall-dlopen.exp: New file. + * gdb.cp/infcall-dlopen.cc: New file. + * gdb.cp/infcall-dlopen-lib.cc: New file. + +2010-08-17 Jan Kratochvil Pedro Alves PR breakpoints/11371 --- src/gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc +++ src/gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc 2010-08-17 21:31:28.548891000 +0000 @@ -0,0 +1,16 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 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 . */ --- src/gdb/testsuite/gdb.cp/infcall-dlopen.cc +++ src/gdb/testsuite/gdb.cp/infcall-dlopen.cc 2010-08-17 21:31:28.827889000 +0000 @@ -0,0 +1,37 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 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 int +openlib (const char *filename) +{ + void *h = dlopen (filename, RTLD_LAZY); + + if (h == NULL) + return 0; + if (dlclose (h) != 0) + return 0; + return 1; +} + +int +main (void) +{ + return 0; +} --- src/gdb/testsuite/gdb.cp/infcall-dlopen.exp +++ src/gdb/testsuite/gdb.cp/infcall-dlopen.exp 2010-08-17 21:31:29.286129000 +0000 @@ -0,0 +1,46 @@ +# Copyright 2010 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 . + +if {[skip_shlib_tests]} { + return 0 +} + +if [get_compiler_info not-used] { + return -1 +} + +set testfile "infcall-dlopen" +set srcmainfile ${testfile}.cc +set srclibfile ${testfile}-lib.cc +set executable ${testfile} +set libfile ${objdir}/${subdir}/${executable}.so +set binfile ${objdir}/${subdir}/${executable} + +# Use completely arbitrary file for $libfile source. +if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} {debug c++}] != "" + || [prepare_for_testing ${testfile}.exp ${executable} ${srcmainfile} {debug c++ shlib_load}] } { + return -1 +} + +if { ![runto_main] } { + return -1 +} + +for {set i 0} {$i < 10} {incr i} { + gdb_test "p openlib (\"${libfile}\")" " = 1" "test $i" + # Try to exploit the GDB trashed memory. + gdb_test "b openlib" {Breakpoint [0-9]+ at .*} "test $i stub 1" + gdb_test_no_output {delete $bpnum} "test $i stub 2" +}