From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9848 invoked by alias); 5 Jun 2008 16:40:35 -0000 Received: (qmail 9824 invoked by uid 22791); 5 Jun 2008 16:40:33 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 05 Jun 2008 16:40:14 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1K4IVU-0004I5-E8 for gdb-patches@sources.redhat.com; Thu, 05 Jun 2008 16:40:08 +0000 Received: from entropy.qnx.com ([209.226.137.107]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 Jun 2008 16:40:08 +0000 Received: from aristovski by entropy.qnx.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 Jun 2008 16:40:08 +0000 To: gdb-patches@sources.redhat.com From: Aleksandar Ristovski Subject: Re: [patch] PR gdb/1665 pending catch/throw catchpoints Date: Thu, 05 Jun 2008 16:40:00 -0000 Message-ID: <484816DF.2080005@qnx.com> References: <4817E37A.8020705@qnx.com> <20080501201239.GO22218@caradoc.them.org> <481B52B1.2050609@qnx.com> <20080605160543.GC29085@caradoc.them.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090808090903030201050302" User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) In-Reply-To: <20080605160543.GC29085@caradoc.them.org> 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: 2008-06/txt/msg00040.txt.bz2 This is a multi-part message in MIME format. --------------090808090903030201050302 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 588 Daniel Jacobowitz wrote: > Did you deliberately replace (exception thrown) with (thrown) > in your 2008-05-28 patch to print_exception_catchpoint? > No, I'm afraid "exception" part got lost in translation. Sorry about that. Attached is a small patch correcting this. Also attached exception.exp diff (cummulative with your diff), all I did was I removed \r\n from the expected output. With the changes, I get 14 passes. 2008-06-05 Aleksandar Ristovski * breakpoint.c (print_exception_catchpoint): Put 'exception' back to 'exception caught|thrown' message. --------------090808090903030201050302 Content-Type: text/plain; name="breakpoint.c.exceptionthrown-20080605.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="breakpoint.c.exceptionthrown-20080605.diff" Content-length: 703 Index: gdb/breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.322 diff -u -p -r1.322 breakpoint.c --- gdb/breakpoint.c 28 May 2008 14:04:21 -0000 1.322 +++ gdb/breakpoint.c 5 Jun 2008 16:22:39 -0000 @@ -6511,8 +6511,8 @@ print_exception_catchpoint (struct break if (!ui_out_is_mi_like_p (uiout)) ui_out_field_int (uiout, "bkptno", b->number); ui_out_text (uiout, - bp_throw ? " (thrown), " - : " (caught), "); + bp_throw ? " (exception thrown), " + : " (exception caught), "); if (ui_out_is_mi_like_p (uiout)) { ui_out_field_string (uiout, "reason", --------------090808090903030201050302 Content-Type: text/plain; name="exception.exp-20080605.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="exception.exp-20080605.diff" Content-length: 8091 Index: gdb/testsuite/gdb.cp/exception.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/exception.exp,v retrieving revision 1.12 diff -u -p -r1.12 exception.exp --- gdb/testsuite/gdb.cp/exception.exp 1 Jan 2008 22:53:19 -0000 1.12 +++ gdb/testsuite/gdb.cp/exception.exp 5 Jun 2008 16:36:09 -0000 @@ -27,10 +27,6 @@ # Static-linked executables use a different mechanism to get the # address of the notification hook in the C++ support library. -# TODO: this file is not ready for production yet. If you are working -# on C++ exception support for gdb, you can take out the "continue" -# statement and try your luck. -- chastain 2004-01-09 - # TODO: this file has many absolute line numbers. # Replace them with gdb_get_line_number. @@ -67,56 +63,69 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -if ![runto_main] then { - perror "couldn't run to breakpoint" - continue -} - -# As I said before, this test script is not ready yet! - -continue - # Set a catch catchpoint -gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" +gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" \ + "catch catch (before inferior run)" # Set a throw catchpoint gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \ - "catch throw (static executable)" + "catch throw (before inferior run)" -# The catchpoints should be listed in the list of breakpoints. +# The catchpoints should be listed in the list of breakpoints. +# In case of a statically linked test, we won't have a pending breakpoint. +# Hence we allow for both an address or "". If we ever become able +# to tell whether the target is linked statically or not, we can be more +# precise and require exact output. +set addr "\(|$hex\)" set re_head "Num${ws}Type${ws}Disp${ws}Enb${ws}Address${ws}What" -set re_1_main "1${ws}breakpoint${ws}keep${ws}y${ws}$hex${ws}in main.*breakpoint already hit.*" -set re_2_catch "2${ws}catch catch${ws}keep${ws}y${ws}$hex${ws}exception catch" -set re_3_catch "3${ws}catch throw${ws}keep${ws}y${ws}$hex${ws}exception throw" -set re_2_bp "2${ws}breakpoint${ws}keep${ws}y${ws}$hex${ws}exception catch" -set re_3_bp "3${ws}breakpoint${ws}keep${ws}y${ws}$hex${ws}exception throw" +set re_2_bp "1${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception catch" +set re_3_bp "2${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception throw" -set name "info breakpoints" +set name "info breakpoints (before inferior run)" gdb_test_multiple "info breakpoints" $name { - -re "$re_head${ws}$re_1_main${ws}$re_2_catch${ws}$re_3_catch\r\n$gdb_prompt $" { + -re "$re_head${ws}$re_2_bp${ws}$re_3_bp\r\n$gdb_prompt $" { pass $name } - -re "$re_head${ws}$re_1_main${ws}$re_2_bp${ws}$re_3_bp\r\n$gdb_prompt $" { - # TODO: gdb HEAD 2004-01-08 does this. Is this okay? - unresolved $name - } + -re ".*$gdb_prompt $" + { + fail $name + } } -# Some targets support "info catch". -# Some do not. +gdb_test "tbreak main" "Temporary breakpoint 3.*" \ + "Set temporary breakpoint at main" -set name "info catch" -gdb_test_multiple "info catch" $name { - -re "Info catch not supported with this target/compiler combination.\r\n$gdb_prompt $" { - unsupported $name +set ok 0 +gdb_run_cmd +gdb_test_multiple "" "Run to main" { + -re "Temporary breakpoint 3,.*$gdb_prompt $" { + pass "Run to main" + set ok 1 } - -re "No catches.\r\n$gdb_prompt $" { - # TODO: gdb HEAD 2004-01-08 does this. Is this okay? - unresolved $name +} + +if { !$ok } { + continue +} + +set addr "$hex" +set re_head "Num${ws}Type${ws}Disp${ws}Enb${ws}Address${ws}What" +set re_2_bp "1${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception catch" +set re_3_bp "2${ws}breakpoint${ws}keep${ws}y${ws}$addr${ws}exception throw" + +set name "info breakpoints (after inferior run)" +gdb_test_multiple "info breakpoints" $name { + -re "$re_head${ws}$re_2_bp${ws}$re_3_bp\r\n$gdb_prompt $" { + pass $name } + -re ".*$gdb_prompt $" + { + send_user "\n---\n$expect_out(buffer)\n---\n" + fail $name + } } # Get the first exception thrown @@ -126,9 +135,8 @@ gdb_test_multiple "continue" $name { -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\), throw location.*${srcfile}:30, catch location .*${srcfile}:50\r\n$gdb_prompt $" { pass $name } - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\)\r\n.*\r\n$gdb_prompt $" { - # TODO: gdb HEAD 2004-01-08 does this. Is this okay? - unresolved $name + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*\r\n$gdb_prompt $" { + pass $name } } @@ -137,7 +145,7 @@ gdb_test_multiple "continue" $name { set name "backtrace after first throw" gdb_test_multiple "backtrace" $name { - -re ".*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:30\r\n#\[0-9\]+${ws}$hex in main \\((void|)\\) at .*${srcfile}:48\r\n$gdb_prompt $" { + -re ".*#\[0-9\]+${ws}$hex in __cxa_throw.*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { pass $name } } @@ -149,9 +157,8 @@ gdb_test_multiple "continue" $name { -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\), throw location.*${srcfile}:30, catch location .*${srcfile}:50\r\n$gdb_prompt $" { pass $name } - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\)\r\n.*\r\n$gdb_prompt $" { - # TODO: gdb HEAD 2004-01-08 does this. Is this okay? - unresolved $name + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\).*\r\n$gdb_prompt $" { + pass $name } } @@ -160,7 +167,7 @@ gdb_test_multiple "continue" $name { set name "backtrace after first catch" gdb_test_multiple "backtrace" $name { - -re ".*#\[0-9\]+${ws}$hex in main \\((void|)\\) at .*$srcfile:50\r\n$gdb_prompt $" { + -re ".*#\[0-9\]+${ws}$hex in __cxa_begin_catch.*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { pass $name } } @@ -172,9 +179,8 @@ gdb_test_multiple "continue" $name { -re "Continuing.${ws}Got an except 13${ws}Catchpoint \[0-9\]+ \\(exception thrown\\), throw location.*${srcfile}:30, catch location .*${srcfile}:58\r\n$gdb_prompt $" { pass $name } - -re "Continuing.${ws}Got an except 13${ws}Catchpoint \[0-9\]+ \\(exception thrown\\)\r\n.*\r\n$gdb_prompt $" { - # TODO: gdb HEAD 2004-01-08 does this. Is this okay? - unresolved $name + -re "Continuing.${ws}Got an except 13${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*\r\n$gdb_prompt $" { + pass $name } } @@ -183,7 +189,7 @@ gdb_test_multiple "continue" $name { set name "backtrace after second throw" gdb_test_multiple "backtrace" $name { - -re ".*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:30\r\n#\[0-9\]+${ws}$hex in main \\((void|)\\) at .*${srcfile}:56\r\n$gdb_prompt $" { + -re ".*#\[0-9\]+${ws}$hex in __cxa_throw.*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { pass $name } } @@ -195,9 +201,8 @@ gdb_test_multiple "continue" $name { -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\), throw location.*${srcfile}:30, catch location .*${srcfile}:58\r\n$gdb_prompt $" { pass $name } - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\)\r\n.*\r\n$gdb_prompt $" { - # TODO: gdb HEAD 2004-01-08 does this. Is this okay? - unresolved $name + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\).*\r\n$gdb_prompt $" { + pass $name } } @@ -206,7 +211,7 @@ gdb_test_multiple "continue" $name { set name "backtrace after second catch" gdb_test_multiple "backtrace" $name { - -re ".*#\[0-9\]+${ws}$hex in main \\((void|)\\) at .*$srcfile:58\r\n$gdb_prompt $" { + -re ".*#\[0-9\]+${ws}$hex in __cxa_begin_catch.*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { pass $name } } --------------090808090903030201050302--