Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] PR gdb/1665 pending catch/throw catchpoints
@ 2008-04-29 22:30 Aleksandar Ristovski
  2008-04-30  7:09 ` Aleksandar Ristovski
  2008-05-01 20:07 ` Daniel Jacobowitz
  0 siblings, 2 replies; 11+ messages in thread
From: Aleksandar Ristovski @ 2008-04-29 22:30 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

Hello,

As per discussion here: 
http://sourceware.org/ml/gdb/2008-04/msg00241.html

Catchpoints for 'catch catch' and 'catch throw' will be made pending if the command is issued before first inferior run. 

Thanks,

Aleksandar Ristovski
QNX Software Systems.


-------------------
ChangeLog:

	PR gdb/1665
	* breakpoint.c (create_breakpoint): Add breakpoint_ops argument and
	assign its value to the breakpoint created.
	(create_breakpoints): Add breakpoint_ops argument and pass it
	to create_breakpoint call.
	(break_command_really): Add breakpoint_ops argument and pass/assign
	appropriately.
	(break_command_1): Pass NULL as ops argument.
	(set_breakpoint): Pass NULL as ops argument.
	(print_one_exception_catchpoint): Print <PENDING> if no loc available.
	(handle_gnu_v3_exceptions): Call generic breakpoint code to insert
	catch and throw catchpoints.

[-- Attachment #2: breakpoint.c.catch.diff --]
[-- Type: text/plain, Size: 4921 bytes --]

Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.316
diff -u -p -r1.316 breakpoint.c
--- gdb/breakpoint.c	26 Apr 2008 05:43:45 -0000	1.316
+++ gdb/breakpoint.c	29 Apr 2008 20:30:21 -0000
@@ -5076,7 +5076,8 @@ static void
 create_breakpoint (struct symtabs_and_lines sals, char *addr_string,
 		   char *cond_string,
 		   enum bptype type, enum bpdisp disposition,
-		   int thread, int ignore_count, int from_tty)
+		   int thread, int ignore_count, 
+		   struct breakpoint_ops *ops, int from_tty)
 {
   struct breakpoint *b = NULL;
   int i;
@@ -5136,6 +5137,7 @@ create_breakpoint (struct symtabs_and_li
        me.  */
     b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address));
 
+  b->ops = ops;
   mention (b);
 }
 
@@ -5280,7 +5282,8 @@ static void
 create_breakpoints (struct symtabs_and_lines sals, char **addr_string,
 		    char *cond_string,
 		    enum bptype type, enum bpdisp disposition,
-		    int thread, int ignore_count, int from_tty)
+		    int thread, int ignore_count, 
+		    struct breakpoint_ops *ops, int from_tty)
 {
   int i;
   for (i = 0; i < sals.nelts; ++i)
@@ -5290,7 +5293,7 @@ create_breakpoints (struct symtabs_and_l
 
       create_breakpoint (expanded, addr_string[i],
 			 cond_string, type, disposition,
-			 thread, ignore_count, from_tty);
+			 thread, ignore_count, ops, from_tty);
     }
 
   update_global_location_list ();
@@ -5458,6 +5461,7 @@ break_command_really (char *arg, char *c
 		      int tempflag, int hardwareflag, 
 		      int ignore_count,
 		      enum auto_boolean pending_break_support,
+		      struct breakpoint_ops *ops,
 		      int from_tty)
 {
   struct gdb_exception e;
@@ -5591,7 +5595,7 @@ break_command_really (char *arg, char *c
 			  hardwareflag ? bp_hardware_breakpoint 
 			  : bp_breakpoint,
 			  tempflag ? disp_del : disp_donttouch,
-			  thread, ignore_count, from_tty);
+			  thread, ignore_count, ops, from_tty);
     }
   else
     {
@@ -5611,6 +5615,7 @@ break_command_really (char *arg, char *c
       b->ignore_count = ignore_count;
       b->disposition = tempflag ? disp_del : disp_donttouch;
       b->condition_not_parsed = 1;
+      b->ops = ops;
 
       update_global_location_list ();
       mention (b);
@@ -5643,7 +5648,9 @@ break_command_1 (char *arg, int flag, in
 			NULL, 0, 1 /* parse arg */,
 			tempflag, hardwareflag,
 			0 /* Ignore count */,
-			pending_break_support, from_tty);
+			pending_break_support, 
+			NULL /* breakpoint_ops */,
+			from_tty);
 }
 
 
@@ -5659,7 +5666,7 @@ set_breakpoint (char *address, char *con
 			ignore_count,
 			pending 
 			? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
-			0);
+			NULL, 0);
 }
 
 /* Adjust SAL to the first instruction past the function prologue.
@@ -6536,10 +6543,14 @@ print_one_exception_catchpoint (struct b
   if (addressprint)
     {
       annotate_field (4);
-      ui_out_field_core_addr (uiout, "addr", b->loc->address);
+      if (b->loc == NULL || b->loc->shlib_disabled)
+	ui_out_field_string (uiout, "addr", "<PENDING>");
+      else
+	ui_out_field_core_addr (uiout, "addr", b->loc->address);
     }
   annotate_field (5);
-  *last_addr = b->loc->address;
+  if (b->loc)
+    *last_addr = b->loc->address;
   if (strstr (b->addr_string, "throw") != NULL)
     ui_out_field_string (uiout, "what", "exception throw");
   else
@@ -6565,38 +6576,22 @@ static int
 handle_gnu_v3_exceptions (int tempflag, char *cond_string,
 			  enum exception_event_kind ex_event, int from_tty)
 {
-  char *trigger_func_name, *nameptr;
-  struct symtabs_and_lines sals;
-  struct breakpoint *b;
-
+  char *trigger_func_name;
+ 
   if (ex_event == EX_EVENT_CATCH)
-    trigger_func_name = xstrdup ("__cxa_begin_catch");
+    trigger_func_name = "__cxa_begin_catch";
   else
-    trigger_func_name = xstrdup ("__cxa_throw");
-
-  nameptr = trigger_func_name;
-  sals = decode_line_1 (&nameptr, 1, NULL, 0, NULL, NULL);
-  if (sals.nelts == 0)
-    {
-      xfree (trigger_func_name);
-      return 0;
-    }
+    trigger_func_name = "__cxa_throw";
 
-  b = set_raw_breakpoint (sals.sals[0], bp_breakpoint);
-  set_breakpoint_count (breakpoint_count + 1);
-  b->number = breakpoint_count;
-  b->cond_string = (cond_string == NULL) ? 
-    NULL : savestring (cond_string, strlen (cond_string));
-  b->thread = -1;
-  b->addr_string = trigger_func_name;
-  b->enable_state = bp_enabled;
-  b->disposition = tempflag ? disp_del : disp_donttouch;
-  b->ops = &gnu_v3_exception_catchpoint_ops;
+  break_command_really (trigger_func_name, cond_string, -1,
+			0 /* condition and thread are valid.  */,
+			0, 0,
+			0,
+			AUTO_BOOLEAN_TRUE /* pending */,
+			&gnu_v3_exception_catchpoint_ops, from_tty);
 
-  xfree (sals.sals);
-  mention (b);
-  update_global_location_list ();
   return 1;
+
 }
 
 /* Deal with "catch catch" and "catch throw" commands */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-04-29 22:30 [patch] PR gdb/1665 pending catch/throw catchpoints Aleksandar Ristovski
@ 2008-04-30  7:09 ` Aleksandar Ristovski
  2008-05-01 20:13   ` Daniel Jacobowitz
  2008-05-01 20:07 ` Daniel Jacobowitz
  1 sibling, 1 reply; 11+ messages in thread
From: Aleksandar Ristovski @ 2008-04-30  7:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

Aleksandar Ristovski wrote:
> Hello,
> 
> As per discussion here: http://sourceware.org/ml/gdb/2008-04/msg00241.html
> 
> Catchpoints for 'catch catch' and 'catch throw' will be made pending if 
> the command is issued before first inferior run.
> Thanks,
> 

In addition to the patch, a patch for the test 'exception.exp' (attached).

This patch adds 14 new PASS-es to the testsuite.

Thanks,

Aleksandar

testuite/ChangeLog

	* gdb.cp/exception.exp: Test pending catchpoints and finish the test
	to remove unresolved and failed tests.

[-- Attachment #2: exception.exp.diff --]
[-- Type: text/plain, Size: 6300 bytes --]

Index: 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
--- exception.exp	1 Jan 2008 22:53:19 -0000	1.12
+++ exception.exp	30 Apr 2008 03:06:57 -0000
@@ -67,57 +67,68 @@ 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 (static executable)"
 
 # Set a throw catchpoint
 
 gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \
     "catch throw (static executable)"
 
+
 # The catchpoints should be listed in the list of breakpoints.
+set addr "<PENDING>"
+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 (pending)"
+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 $"
+      {
+	fail $name
+      }
+}
+
+gdb_test "tbreak main" "Temporary breakpoint 3.*" \
+    "Set temporary breakpoint at main"
+
+gdb_test "run" "Temporary breakpoint 3,.*" "Run to main"
 
+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"
 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.
 
-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
-    }
-    -re "No catches.\r\n$gdb_prompt $" {
-	# TODO: gdb HEAD 2004-01-08 does this.  Is this okay?
-	unresolved $name
-    }
-}
+#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
+#    }
+#    -re "No catches.\r\n$gdb_prompt $" {
+#	# TODO: gdb HEAD 2004-01-08 does this.  Is this okay?
+#	unresolved $name
+#    }
+#}
 
 # Get the first exception thrown
        
@@ -127,8 +138,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -137,7 +147,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
     }
 }
@@ -150,8 +160,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -160,7 +169,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
     }
 }
@@ -173,8 +182,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -183,7 +191,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
     }
 }
@@ -196,8 +204,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -206,7 +213,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
     }
 }

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-04-29 22:30 [patch] PR gdb/1665 pending catch/throw catchpoints Aleksandar Ristovski
  2008-04-30  7:09 ` Aleksandar Ristovski
@ 2008-05-01 20:07 ` Daniel Jacobowitz
  2008-05-01 20:38   ` Aleksandar Ristovski
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2008-05-01 20:07 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: gdb-patches

On Tue, Apr 29, 2008 at 04:36:47PM -0400, Aleksandar Ristovski wrote:
> 	PR gdb/1665
> 	* breakpoint.c (create_breakpoint): Add breakpoint_ops argument and
> 	assign its value to the breakpoint created.
> 	(create_breakpoints): Add breakpoint_ops argument and pass it
> 	to create_breakpoint call.
> 	(break_command_really): Add breakpoint_ops argument and pass/assign
> 	appropriately.
> 	(break_command_1): Pass NULL as ops argument.
> 	(set_breakpoint): Pass NULL as ops argument.
> 	(print_one_exception_catchpoint): Print <PENDING> if no loc available.
> 	(handle_gnu_v3_exceptions): Call generic breakpoint code to insert
> 	catch and throw catchpoints.

Nice patch!  This is OK.

> -  update_global_location_list ();
>    return 1;
> +
>  }

Please don't add this blank line though.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-04-30  7:09 ` Aleksandar Ristovski
@ 2008-05-01 20:13   ` Daniel Jacobowitz
  2008-05-02 17:55     ` Aleksandar Ristovski
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2008-05-01 20:13 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: gdb-patches

On Tue, Apr 29, 2008 at 11:11:54PM -0400, Aleksandar Ristovski wrote:
> -# As I said before, this test script is not ready yet!
> -
> -continue

There's comments higher up about this continue, they need to be
updated too.

>  # Set a catch catchpoint
>  
> -gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)"
> +gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" \
> +    "catch catch (static executable)"
>  
>  # Set a throw catchpoint
>  
>  gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \
>      "catch throw (static executable)"

The descriptions on these are wrong, they aren't for a static
executable.

>  # The catchpoints should be listed in the list of breakpoints.
> +set addr "<PENDING>"
> +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"

This won't work if the C++ library is linked in, e.g. -static or a
bare metal toolchain; it won't be pending.

> +gdb_test "tbreak main" "Temporary breakpoint 3.*" \
> +    "Set temporary breakpoint at main"
> +
> +gdb_test "run" "Temporary breakpoint 3,.*" "Run to main"

There's runto_main, use that instead; it handles remote targets and so
forth.

If you'll try to update this, I can test it on arm-none-eabi or
another bare metal platform.  Running it with
"RUNTESTFLAGS=--target_board unix/-static" should be enough to test
the <PENDING> problem.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-05-01 20:07 ` Daniel Jacobowitz
@ 2008-05-01 20:38   ` Aleksandar Ristovski
  0 siblings, 0 replies; 11+ messages in thread
From: Aleksandar Ristovski @ 2008-05-01 20:38 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
>> -  update_global_location_list ();
>>    return 1;
>> +
>>  }
> 
> Please don't add this blank line though.
> 

Committed without the blank line.


Thanks,

Aleksandar


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-05-01 20:13   ` Daniel Jacobowitz
@ 2008-05-02 17:55     ` Aleksandar Ristovski
  2008-05-02 18:07       ` Aleksandar Ristovski
  2008-06-05 16:06       ` Daniel Jacobowitz
  0 siblings, 2 replies; 11+ messages in thread
From: Aleksandar Ristovski @ 2008-05-02 17:55 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

Daniel Jacobowitz wrote:
> 
> This won't work if the C++ library is linked in, e.g. -static or a
> bare metal toolchain; it won't be pending.

Made test accept both <PENDING> and address.



> 
>> +gdb_test "tbreak main" "Temporary breakpoint 3.*" \
>> +    "Set temporary breakpoint at main"
>> +
>> +gdb_test "run" "Temporary breakpoint 3,.*" "Run to main"
> 
> There's runto_main, use that instead; it handles remote targets and so
> forth.

Yeah, but it wouldn't work in my case as it deletes breakpoints automagically. I introduced new runto_main_new that accepts options like temporary-break and keep-breakpoints.

> 
> If you'll try to update this, I can test it on arm-none-eabi or
> another bare metal platform.  Running it with
> "RUNTESTFLAGS=--target_board unix/-static" should be enough to test
> the <PENDING> problem.
> 

Please do with the attached patch.


Thanks,
Aleksandar

ChangeLog:


	* gdb.cp/exception.exp: Made test functional.
	* lib/gdb.exp (runto): New option: keep-breakpoints to make procedure
	more useful. If the option is not specified, it deletes breakpoints
	like before. Made matching regexp accept both temporary and regular
	breakpoint.
	(runto_main_new): New procedure, to avoid breakage of the existing 
	stuff. This procedure works like runto_main, except it can take
	arguments: temporary-break and keep-breakpoints.


[-- Attachment #2: exception.exp.diff --]
[-- Type: text/plain, Size: 9900 bytes --]

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	2 May 2008 17:40:35 -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,58 @@ 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 "<PENDING>". 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 "\(<PENDING>|$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
+      }
+}
+
+if ![runto_main_new { temporary-break keep-breakpoints }] {
+  perror "Couldn't run to main"
+  continue
 }
 
-# Some targets support "info catch".
-# Some do not.
+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 catch"
-gdb_test_multiple "info catch" $name {
-    -re "Info catch not supported with this target/compiler combination.\r\n$gdb_prompt $" {
-	unsupported $name
-    }
-    -re "No catches.\r\n$gdb_prompt $" {
-	# TODO: gdb HEAD 2004-01-08 does this.  Is this okay?
-	unresolved $name
+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
@@ -127,8 +125,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -137,7 +134,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
     }
 }
@@ -150,8 +147,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -160,7 +156,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
     }
 }
@@ -173,8 +169,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -183,7 +178,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
     }
 }
@@ -196,8 +191,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -206,7 +200,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
     }
 }
Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.101
diff -u -p -r1.101 gdb.exp
--- gdb/testsuite/lib/gdb.exp	24 Apr 2008 10:21:45 -0000	1.101
+++ gdb/testsuite/lib/gdb.exp	2 May 2008 17:40:35 -0000
@@ -371,29 +371,42 @@ proc gdb_breakpoint { function args } {
 # just compare to "function" because it might be a fully qualified,
 # single quoted C++ function specifier.  If there's an additional argument,
 # pass it to gdb_breakpoint.
+# If one of the formal arguments is named 'keep-breakpoints', do not
+# delete breakpoints.
 
 proc runto { function args } {
     global gdb_prompt
     global decimal
+    set do_delete_breakpoints 1
 
-    delete_breakpoints
+    if {[lsearch -exact [lindex $args 0] keep-breakpoints] != -1} {
+      set do_delete_breakpoints 0 
+    }
+   
+    if { $do_delete_breakpoints == 1 } {
+      delete_breakpoints
+    }
 
     if ![gdb_breakpoint $function [lindex $args 0]] {
 	return 0;
     }
 
     gdb_run_cmd
-    
+
+    set breakpointmsg "\(Temporary breakpoint|Breakpoint\)"
+
     # the "at foo.c:36" output we get with -g.
     # the "in func" output we get without -g.
     gdb_expect 30 {
-	-re "Break.* at .*:$decimal.*$gdb_prompt $" {
+	-re "${breakpointmsg} \[0-9\]+, .* at .*:$decimal.*$gdb_prompt $" {
 	    return 1
 	}
-	-re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in .*$gdb_prompt $" { 
+	-re "${breakpointmsg} \[0-9\]+, \[0-9xa-f\]* in .*$gdb_prompt $" { 
+	  send_user "Matched: \n---\n$expect_out(buffer)\n---\n"
 	    return 1
 	}
-	-re "$gdb_prompt $" { 
+	-re "$gdb_prompt $" {
+	    send_user "\n***\n$expect_out(buffer)\n***\n"
 	    fail "running to $function in runto"
 	    return 0
 	}
@@ -426,6 +439,43 @@ proc runto_main { } {
     return 1
 }
 
+#
+# runto_main_new -- ask gdb to run until we hit a breakpoint at main.
+#		The case where the target uses stubs has to be handled
+#		specially--if it uses stubs, assuming we hit
+#		breakpoint() and just step out of the function.
+#	opts - arguments. Possible values: 
+#		'temporary-break' - use tbreak main
+#		'keep-breakpoints' - do not delete breakpoints
+#	if opts is empty list, it behaves as runto_main.
+#
+proc runto_main_new { opts } {
+    global gdb_prompt
+    global decimal
+    set do_delete_breakpoints 1
+
+    if {[lsearch -exact [lindex $opts 0] temporary-break ] != -1} {
+# gdb_breakpoint understands 'temporary'.
+      lappend opts temporary
+    }
+
+    if ![target_info exists gdb_stub] {
+	return [runto main $opts ]
+    }			
+
+    if {[lsearch -exact [lindex $opts 0] keep-breakpoints ] != -1} {
+      set do_delete_breakpoints 0
+      send_user "Keeping breakpoints\n"
+    }
+
+    if { $do_delete_breakpoints == 1 } {
+      delete_breakpoints
+    }
+
+    gdb_step_for_stub;
+
+    return 1
+}
 
 ### Continue, and expect to hit a breakpoint.
 ### Report a pass or fail, depending on whether it seems to have

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-05-02 17:55     ` Aleksandar Ristovski
@ 2008-05-02 18:07       ` Aleksandar Ristovski
  2008-06-05 16:06       ` Daniel Jacobowitz
  1 sibling, 0 replies; 11+ messages in thread
From: Aleksandar Ristovski @ 2008-05-02 18:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

Daniel Jacobowitz wrote:
> 
> This won't work if the C++ library is linked in, e.g. -static or a
> bare metal toolchain; it won't be pending.

Made test accept both <PENDING> and address.



> 
>> +gdb_test "tbreak main" "Temporary breakpoint 3.*" \
>> +    "Set temporary breakpoint at main"
>> +
>> +gdb_test "run" "Temporary breakpoint 3,.*" "Run to main"
> 
> There's runto_main, use that instead; it handles remote targets and so
> forth.

Yeah, but it wouldn't work in my case as it deletes breakpoints automagically. I introduced new runto_main_new that accepts options like temporary-break and keep-breakpoints.

> 
> If you'll try to update this, I can test it on arm-none-eabi or
> another bare metal platform.  Running it with
> "RUNTESTFLAGS=--target_board unix/-static" should be enough to test
> the <PENDING> problem.
> 

Please do with the attached patch.


Thanks,
Aleksandar

ChangeLog:


	* gdb.cp/exception.exp: Made test functional.
	* lib/gdb.exp (runto): New option: keep-breakpoints to make procedure
	more useful. If the option is not specified, it deletes breakpoints
	like before. Made matching regexp accept both temporary and regular
	breakpoint.
	(runto_main_new): New procedure, to avoid breakage of the existing 
	stuff. This procedure works like runto_main, except it can take
	arguments: temporary-break and keep-breakpoints.


[-- Attachment #2: exception.exp.diff --]
[-- Type: text/plain, Size: 9900 bytes --]

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	2 May 2008 17:40:35 -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,58 @@ 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 "<PENDING>". 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 "\(<PENDING>|$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
+      }
+}
+
+if ![runto_main_new { temporary-break keep-breakpoints }] {
+  perror "Couldn't run to main"
+  continue
 }
 
-# Some targets support "info catch".
-# Some do not.
+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 catch"
-gdb_test_multiple "info catch" $name {
-    -re "Info catch not supported with this target/compiler combination.\r\n$gdb_prompt $" {
-	unsupported $name
-    }
-    -re "No catches.\r\n$gdb_prompt $" {
-	# TODO: gdb HEAD 2004-01-08 does this.  Is this okay?
-	unresolved $name
+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
@@ -127,8 +125,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -137,7 +134,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
     }
 }
@@ -150,8 +147,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -160,7 +156,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
     }
 }
@@ -173,8 +169,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -183,7 +178,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
     }
 }
@@ -196,8 +191,7 @@ gdb_test_multiple "continue" $name {
 	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
+	pass $name
     }
 }
 
@@ -206,7 +200,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
     }
 }
Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.101
diff -u -p -r1.101 gdb.exp
--- gdb/testsuite/lib/gdb.exp	24 Apr 2008 10:21:45 -0000	1.101
+++ gdb/testsuite/lib/gdb.exp	2 May 2008 17:40:35 -0000
@@ -371,29 +371,42 @@ proc gdb_breakpoint { function args } {
 # just compare to "function" because it might be a fully qualified,
 # single quoted C++ function specifier.  If there's an additional argument,
 # pass it to gdb_breakpoint.
+# If one of the formal arguments is named 'keep-breakpoints', do not
+# delete breakpoints.
 
 proc runto { function args } {
     global gdb_prompt
     global decimal
+    set do_delete_breakpoints 1
 
-    delete_breakpoints
+    if {[lsearch -exact [lindex $args 0] keep-breakpoints] != -1} {
+      set do_delete_breakpoints 0 
+    }
+   
+    if { $do_delete_breakpoints == 1 } {
+      delete_breakpoints
+    }
 
     if ![gdb_breakpoint $function [lindex $args 0]] {
 	return 0;
     }
 
     gdb_run_cmd
-    
+
+    set breakpointmsg "\(Temporary breakpoint|Breakpoint\)"
+
     # the "at foo.c:36" output we get with -g.
     # the "in func" output we get without -g.
     gdb_expect 30 {
-	-re "Break.* at .*:$decimal.*$gdb_prompt $" {
+	-re "${breakpointmsg} \[0-9\]+, .* at .*:$decimal.*$gdb_prompt $" {
 	    return 1
 	}
-	-re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in .*$gdb_prompt $" { 
+	-re "${breakpointmsg} \[0-9\]+, \[0-9xa-f\]* in .*$gdb_prompt $" { 
+	  send_user "Matched: \n---\n$expect_out(buffer)\n---\n"
 	    return 1
 	}
-	-re "$gdb_prompt $" { 
+	-re "$gdb_prompt $" {
+	    send_user "\n***\n$expect_out(buffer)\n***\n"
 	    fail "running to $function in runto"
 	    return 0
 	}
@@ -426,6 +439,43 @@ proc runto_main { } {
     return 1
 }
 
+#
+# runto_main_new -- ask gdb to run until we hit a breakpoint at main.
+#		The case where the target uses stubs has to be handled
+#		specially--if it uses stubs, assuming we hit
+#		breakpoint() and just step out of the function.
+#	opts - arguments. Possible values: 
+#		'temporary-break' - use tbreak main
+#		'keep-breakpoints' - do not delete breakpoints
+#	if opts is empty list, it behaves as runto_main.
+#
+proc runto_main_new { opts } {
+    global gdb_prompt
+    global decimal
+    set do_delete_breakpoints 1
+
+    if {[lsearch -exact [lindex $opts 0] temporary-break ] != -1} {
+# gdb_breakpoint understands 'temporary'.
+      lappend opts temporary
+    }
+
+    if ![target_info exists gdb_stub] {
+	return [runto main $opts ]
+    }			
+
+    if {[lsearch -exact [lindex $opts 0] keep-breakpoints ] != -1} {
+      set do_delete_breakpoints 0
+      send_user "Keeping breakpoints\n"
+    }
+
+    if { $do_delete_breakpoints == 1 } {
+      delete_breakpoints
+    }
+
+    gdb_step_for_stub;
+
+    return 1
+}
 
 ### Continue, and expect to hit a breakpoint.
 ### Report a pass or fail, depending on whether it seems to have

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-05-02 17:55     ` Aleksandar Ristovski
  2008-05-02 18:07       ` Aleksandar Ristovski
@ 2008-06-05 16:06       ` Daniel Jacobowitz
  2008-06-05 16:40         ` Aleksandar Ristovski
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2008-06-05 16:06 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: gdb-patches

Sorry for the delay.

On Fri, May 02, 2008 at 01:43:13PM -0400, Aleksandar Ristovski wrote:
>>> +gdb_test "tbreak main" "Temporary breakpoint 3.*" \
>>> +    "Set temporary breakpoint at main"
>>> +
>>> +gdb_test "run" "Temporary breakpoint 3,.*" "Run to main"
>>
>> There's runto_main, use that instead; it handles remote targets and so
>> forth.
>
> Yeah, but it wouldn't work in my case as it deletes breakpoints automagically. I introduced new runto_main_new that accepts options like temporary-break and keep-breakpoints.

In that case, you just need gdb_run_cmd instead of runto_main.  Then
you can expect exactly the output you need.

With that changed (replacement patch attached) I get:

continue
Continuing.
Catchpoint 2 (thrown), 0x00026610 in __cxa_throw ()
(gdb) FAIL: gdb.cp/exception.exp: continue to first throw

continue
Continuing.
Catchpoint 1 (caught), 0x00025094 in __cxa_begin_catch ()
(gdb) FAIL: gdb.cp/exception.exp: continue to first catch

continue
Continuing.
Got an except 13
Catchpoint 2 (thrown), 0x00026610 in __cxa_throw ()
(gdb) FAIL: gdb.cp/exception.exp: continue to second throw

continue
Continuing.
Catchpoint 1 (caught), 0x00025094 in __cxa_begin_catch ()
(gdb) FAIL: gdb.cp/exception.exp: continue to second catch

Did you deliberately replace (exception thrown) with (thrown)
in your 2008-05-28 patch to print_exception_catchpoint?

-- 
Daniel Jacobowitz
CodeSourcery

Index: 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
--- exception.exp	1 Jan 2008 22:53:19 -0000	1.12
+++ exception.exp	5 Jun 2008 16:05: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 "<PENDING>". 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 "\(<PENDING>|$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
@@ -127,8 +136,7 @@ gdb_test_multiple "continue" $name {
 	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
+	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
     }
 }
@@ -150,8 +158,7 @@ gdb_test_multiple "continue" $name {
 	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
+	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
     }
 }
@@ -173,8 +180,7 @@ gdb_test_multiple "continue" $name {
 	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
+	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
     }
 }
@@ -196,8 +202,7 @@ gdb_test_multiple "continue" $name {
 	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
+	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
     }
 }


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-06-05 16:06       ` Daniel Jacobowitz
@ 2008-06-05 16:40         ` Aleksandar Ristovski
  2008-06-05 17:36           ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Aleksandar Ristovski @ 2008-06-05 16:40 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

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  <aristovski@qnx.com>

	* breakpoint.c (print_exception_catchpoint): Put 'exception' back to 'exception caught|thrown' message.




[-- Attachment #2: breakpoint.c.exceptionthrown-20080605.diff --]
[-- Type: text/plain, Size: 703 bytes --]

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", 

[-- Attachment #3: exception.exp-20080605.diff --]
[-- Type: text/plain, Size: 8091 bytes --]

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 "<PENDING>". 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 "\(<PENDING>|$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
     }
 }

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-06-05 16:40         ` Aleksandar Ristovski
@ 2008-06-05 17:36           ` Daniel Jacobowitz
  2008-06-05 18:40             ` Aleksandar Ristovski
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2008-06-05 17:36 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: gdb-patches

On Thu, Jun 05, 2008 at 12:39:59PM -0400, Aleksandar Ristovski wrote:
> 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  <aristovski@qnx.com>
>
> 	* breakpoint.c (print_exception_catchpoint): Put 'exception' back to 'exception caught|thrown' message.

This is OK, and so is the revised exception.exp patch.  Thanks.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] PR gdb/1665 pending catch/throw catchpoints
  2008-06-05 17:36           ` Daniel Jacobowitz
@ 2008-06-05 18:40             ` Aleksandar Ristovski
  0 siblings, 0 replies; 11+ messages in thread
From: Aleksandar Ristovski @ 2008-06-05 18:40 UTC (permalink / raw)
  To: gdb-patches

Daniel Jacobowitz wrote:
> On Thu, Jun 05, 2008 at 12:39:59PM -0400, Aleksandar Ristovski wrote:
>> 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  <aristovski@qnx.com>
>>
>> 	* breakpoint.c (print_exception_catchpoint): Put 'exception' back to 'exception caught|thrown' message.
> 
> This is OK, and so is the revised exception.exp patch.  Thanks.
> 

Committed.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-06-05 18:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-29 22:30 [patch] PR gdb/1665 pending catch/throw catchpoints Aleksandar Ristovski
2008-04-30  7:09 ` Aleksandar Ristovski
2008-05-01 20:13   ` Daniel Jacobowitz
2008-05-02 17:55     ` Aleksandar Ristovski
2008-05-02 18:07       ` Aleksandar Ristovski
2008-06-05 16:06       ` Daniel Jacobowitz
2008-06-05 16:40         ` Aleksandar Ristovski
2008-06-05 17:36           ` Daniel Jacobowitz
2008-06-05 18:40             ` Aleksandar Ristovski
2008-05-01 20:07 ` Daniel Jacobowitz
2008-05-01 20:38   ` Aleksandar Ristovski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox