public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-pmuldoon-next-over-throw: Fix two "finish" bugs
@ 2009-02-23 20:49 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2009-02-23 20:49 UTC (permalink / raw)
  To: archer-commits

The branch, archer-pmuldoon-next-over-throw has been updated
       via  24b21a09e7ca0b0205aa351b494b90fca698445a (commit)
      from  8e4044d88a1443962bfe4612a3a18543758e775e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 24b21a09e7ca0b0205aa351b494b90fca698445a
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Feb 23 13:46:57 2009 -0700

    Fix two "finish" bugs
    
    gdb
    	* breakpoint.h (set_exception_breakpoint): Update.
    	* breakpoint.c (set_exception_breakpoint): Add frame argument.
    	* infcmd.c (finish_command_continuation): Call
    	delete_longjmp_breakpoint.
    	(step_1): Update.
    
    gdb/testsuite
    	* gdb.cp/gdb9593.cc (NextOverThrowDerivates::finish): New
    	function.
    	(main): Call it.

-----------------------------------------------------------------------

Summary of changes:
 gdb/breakpoint.c                 |    3 +--
 gdb/breakpoint.h                 |    2 +-
 gdb/infcmd.c                     |    5 +++--
 gdb/testsuite/gdb.cp/gdb9593.cc  |   24 ++++++++++++++++++++++++
 gdb/testsuite/gdb.cp/gdb9593.exp |   14 +++++++++++++-
 5 files changed, 42 insertions(+), 6 deletions(-)

First 500 lines of diff:
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 69ed0f2..2083006 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4509,7 +4509,7 @@ delete_longjmp_breakpoint (int thread)
    current frame.  */
 
 CORE_ADDR
-set_exception_breakpoint (void)
+set_exception_breakpoint (struct frame_info *frame)
 {
   struct minimal_symbol *debug_hook;
   struct symbol *debug_trigger;
@@ -4522,7 +4522,6 @@ set_exception_breakpoint (void)
 				 VAR_DOMAIN, NULL);
   if (debug_hook != NULL && debug_trigger != NULL)
     {
-      struct frame_info *frame = get_current_frame ();
       struct value *lhs, *rhs;
       CORE_ADDR pc;
 
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index de3074a..a5b9728 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -784,7 +784,7 @@ extern int detach_breakpoints (int);
 extern void set_longjmp_breakpoint (void);
 extern void delete_longjmp_breakpoint (int thread);
 
-extern CORE_ADDR set_exception_breakpoint (void);
+extern CORE_ADDR set_exception_breakpoint (struct frame_info *);
 
 extern void enable_overlay_breakpoints (void);
 extern void disable_overlay_breakpoints (void);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index ac24494..00a1bbd 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -799,7 +799,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
  	thread = pid_to_thread_id (inferior_ptid);
 
       set_longjmp_breakpoint ();
-      tp->exception_frame = set_exception_breakpoint ();
+      tp->exception_frame = set_exception_breakpoint (get_current_frame ());
       make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
     }
 
@@ -1385,6 +1385,7 @@ finish_command_continuation (void *arg)
   observer_notify_normal_stop (bs);
   suppress_stop_observer = 0;
   delete_breakpoint (a->breakpoint);
+  delete_longjmp_breakpoint (inferior_thread ()->num);
 }
 
 static void
@@ -1475,7 +1476,7 @@ finish_forward (struct symbol *function, struct frame_info *frame)
 
   old_chain = make_cleanup_delete_breakpoint (breakpoint);
 
-  tp->exception_frame = set_exception_breakpoint ();
+  tp->exception_frame = set_exception_breakpoint (frame);
   make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
 
   tp->proceed_to_finish = 1;    /* We want stop_registers, please...  */
diff --git a/gdb/testsuite/gdb.cp/gdb9593.cc b/gdb/testsuite/gdb.cp/gdb9593.cc
index 0b5cb21..00d025d 100644
--- a/gdb/testsuite/gdb.cp/gdb9593.cc
+++ b/gdb/testsuite/gdb.cp/gdb9593.cc
@@ -64,6 +64,21 @@ public:
 	throw;
       }
   }
+
+  void finish ()
+  {
+    // We use this to test that a "finish" here does not end up in
+    // this frame, but in the one above.
+    try
+      {
+	function1 ();
+      }
+    catch (int x)
+      {
+      }
+    function1 ();
+  }
+
 };
 NextOverThrowDerivates next_cases;
 
@@ -119,5 +134,14 @@ int main ()
     {
       // Discard
     }
+
+  // Another test for "finish".
+  try
+    {
+      next_cases.finish ();
+    }
+  catch (...)
+    {
+    }
 }
 
diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp
index 8f1bf35..adf45bc 100644
--- a/gdb/testsuite/gdb.cp/gdb9593.exp
+++ b/gdb/testsuite/gdb.cp/gdb9593.exp
@@ -105,4 +105,16 @@ gdb_test "step" \
 
 gdb_test "finish" \
   ".*catch (...).*" \
-  "finish"
+  "finish 1"
+
+gdb_test "next" \
+  ".*next_cases.finish ().*" \
+  "next past catch 4"
+
+gdb_test "step" \
+  ".*function1 ().*" \
+  "step into finish method"
+
+gdb_test "finish" \
+  ".*catch (...).*" \
+  "finish 2"


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-23 20:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-23 20:49 [SCM] archer-pmuldoon-next-over-throw: Fix two "finish" bugs tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).