public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-pmuldoon-next-over-throw2: Change to work on PPC64 Use lookup_minimal_symbol, not lookup_minimal_symbol_text Use gdbarch_convert_from_func_ptr_addr
@ 2010-12-01 21:37 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2010-12-01 21:37 UTC (permalink / raw)
  To: archer-commits

The branch, archer-pmuldoon-next-over-throw2 has been updated
       via  df187073dfc58e3e517c9d4f61d4742f8d5d9866 (commit)
       via  f49197d5594c66960c82e20f1c40ae29bbe3ae69 (commit)
      from  c74176570191a5553a0faaca04cd2ce395d6b6a4 (commit)

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

- Log -----------------------------------------------------------------
commit df187073dfc58e3e517c9d4f61d4742f8d5d9866
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Dec 1 14:36:16 2010 -0700

    Change to work on PPC64
    Use lookup_minimal_symbol, not lookup_minimal_symbol_text
    Use gdbarch_convert_from_func_ptr_addr

commit f49197d5594c66960c82e20f1c40ae29bbe3ae69
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Dec 1 14:35:51 2010 -0700

    rewrite test cases to be more robust

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

Summary of changes:
 gdb/breakpoint.c                       |   10 +-
 gdb/testsuite/gdb.cp/nextoverthrow.cc  |   99 ++++++++++------
 gdb/testsuite/gdb.cp/nextoverthrow.exp |  193 +++++++++++++++-----------------
 3 files changed, 156 insertions(+), 146 deletions(-)

First 500 lines of diff:
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 8e64655..11bfc11 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2212,14 +2212,16 @@ create_exception_master_breakpoint (void)
     {
       struct minimal_symbol *debug_hook;
 
-      debug_hook = lookup_minimal_symbol_text ("_Unwind_DebugHook", objfile);
+      debug_hook = lookup_minimal_symbol ("_Unwind_DebugHook", NULL, objfile);
       if (debug_hook != NULL)
 	{
 	  struct breakpoint *b;
+	  CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (debug_hook);
+	  struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
-	  b = create_internal_breakpoint (get_objfile_arch (objfile),
-					  SYMBOL_VALUE_ADDRESS (debug_hook),
-					  bp_exception_master);
+	  addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
+						     &current_target);
+	  b = create_internal_breakpoint (gdbarch, addr, bp_exception_master);
 	  b->addr_string = xstrdup ("_Unwind_DebugHook");
 	  b->enable_state = bp_disabled;
 	}
diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.cc b/gdb/testsuite/gdb.cp/nextoverthrow.cc
index c9a36e6..b25cb34 100644
--- a/gdb/testsuite/gdb.cp/nextoverthrow.cc
+++ b/gdb/testsuite/gdb.cp/nextoverthrow.cc
@@ -19,6 +19,10 @@
 
 using namespace std;
 
+void dummy ()
+{
+}
+
 class NextOverThrowDerivates
 {
 
@@ -26,25 +30,25 @@ public:
 
 
   // Single throw an exception in this function.
-  void function1() 
+  void function1 (int val)
   {
-    throw 20;
+    throw val;
   }
 
   // Throw an exception in another function.
-  void function2() 
+  void function2 (int val)
   {
-    function1();
+    function1 (val);
   }
 
   // Throw an exception in another function, but handle it
   // locally.
-  void function3 () 
+  void function3 (int val)
   {
     {
       try
 	{
-	  function1 ();
+	  function1 (val);
 	}
       catch (...) 
 	{
@@ -53,11 +57,11 @@ public:
     }
   }
 
-  void rethrow ()
+  void rethrow (int val)
   {
     try
       {
-	function1 ();
+	function1 (val);
       }
     catch (...)
       {
@@ -65,24 +69,24 @@ public:
       }
   }
 
-  void finish ()
+  void finish (int val)
   {
     // We use this to test that a "finish" here does not end up in
     // this frame, but in the one above.
     try
       {
-	function1 ();
+	function1 (val);
       }
     catch (int x)
       {
       }
-    function1 ();		// marker for until
+    function1 (val);		// marker for until
   }
 
-  void until ()
+  void until (int val)
   {
-    function1 ();
-    function1 ();		// until here
+    function1 (val);
+    function1 (val);		// until here
   }
 
 };
@@ -91,90 +95,109 @@ NextOverThrowDerivates next_cases;
 
 int main () 
 { 
+  int testval = -1;
+
   try
     {
-      next_cases.function1 ();
+      next_cases.function1 (0);	// Start: first test
     }
-  catch (...)
+  catch (int val)
     {
-      // Discard
+      dummy ();
+      testval = val;		// End: first test
     }
 
   try
     {
-      next_cases.function2 ();
+      next_cases.function2 (1);	// Start: nested throw
     }
-  catch (...)
+  catch (int val)
     {
-      // Discard
+      dummy ();
+      testval = val;		// End: nested throw
     }
 
   try
     {
       // This is duplicated so we can next over one but step into
       // another.
-      next_cases.function2 ();
+      next_cases.function2 (2);	// Start: step in test
     }
-  catch (...)
+  catch (int val)
     {
-      // Discard
+      dummy ();
+      testval = val;		// End: step in test
     }
 
-  next_cases.function3 ();
+  next_cases.function3 (3);	// Start: next past catch
+  dummy ();
+  testval = 3;			// End: next past catch
 
   try
     {
-      next_cases.rethrow ();
+      next_cases.rethrow (4);	// Start: rethrow
     }
-  catch (...)
+  catch (int val)
     {
-      // Discard
+      dummy ();
+      testval = val;		// End: rethrow
     }
 
   try
     {
       // Another duplicate so we can test "finish".
-      next_cases.function2 ();
+      next_cases.function2 (5);	// Start: first finish
     }
-  catch (...)
+  catch (int val)
     {
-      // Discard
+      dummy ();
+      testval = val;		// End: first finish
     }
 
   // Another test for "finish".
   try
     {
-      next_cases.finish ();
+      next_cases.finish (6);	// Start: second finish
     }
-  catch (...)
+  catch (int val)
     {
+      dummy ();
+      testval = val;		// End: second finish
     }
 
   // Test of "until".
   try
     {
-      next_cases.finish ();
+      next_cases.finish (7);	// Start: first until
     }
-  catch (...)
+  catch (int val)
     {
+      dummy ();
+      testval = val;		// End: first until
     }
 
   // Test of "until" with an argument.
   try
     {
-      next_cases.until ();
+      next_cases.until (8);	// Start: second until
     }
-  catch (...)
+  catch (int val)
     {
+      dummy ();
+      testval = val;		// End: second until
     }
 
   // Test of "advance".
   try
     {
-      next_cases.until ();
+      next_cases.until (9);	// Start: advance
     }
-  catch (...)
+  catch (int val)
     {
+      dummy ();
+      testval = val;		// End: advance
     }
+
+  testval = 32;			// done
 }
 
diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.exp b/gdb/testsuite/gdb.cp/nextoverthrow.exp
index e03719f..960ea0d 100644
--- a/gdb/testsuite/gdb.cp/nextoverthrow.exp
+++ b/gdb/testsuite/gdb.cp/nextoverthrow.exp
@@ -57,112 +57,97 @@ if {!$ok} {
     return -1
 }
 
-# See http://sourceware.org/bugzilla/show_bug.cgi?id=9593
-
-gdb_test "next" \
-    "catch (...).*" \
-    "next over a throw 1"
-
-gdb_test "next" \
-  "next_cases.function2.*" \
-  "next past catch 1"
-
-gdb_test "next" \
-    "catch (...).*" \
-    "next over a throw 2"
-
-gdb_test "next" \
-  "next_cases.function2.*" \
-  "next past catch 2"
-
-gdb_test "step" \
-  "function1().*" \
-  "step into function2 1"
-
-gdb_test "next" \
-    "catch (...).*" \
-    "next over a throw 3"
-
-gdb_test "next" \
-  "next_cases.function3.*" \
-  "next past catch 3"
-
-gdb_test "next" \
-  "next_cases.rethrow.*" \
-    "next over a throw 4"
-
-gdb_test "next" \
-  "catch (...).*" \
-  "next over a rethrow"
-
-gdb_test "next" \
-  "next_cases.function2.*" \
-  "next after a rethrow"
-
-gdb_test "step" \
-  "function1().*" \
-  "step into function2 2"
-
-gdb_test "finish" \
-  "catch (...).*" \
-  "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"
-
-gdb_test "next" \
-  "next_cases.finish ().*" \
-  "next past catch 5"
-
-gdb_test "step" \
-  "function1 ().*" \
-  "step into finish, for until"
+# Set a temporary breakpoint and then continue to it.
+# The breakpoint is set according to a marker in the file.
+proc tbreak_and_cont {text} {
+    global testfile
+
+    set line [gdb_get_line_number $text $testfile.cc]
+    gdb_breakpoint "$testfile.cc:$line" temporary
+    gdb_test "continue" "Temporary breakpoint.*" "continuing to $text"
+}
 
-gdb_test "until" \
-  "function1 ().*" \
-  "until with no argument 1"
+# Verify the value of testval.
+proc verify_testval {name value} {
+    gdb_test "print testval == $value" " = true" $name
+}
 
+# See http://sourceware.org/bugzilla/show_bug.cgi?id=9593
+# Our general approach here is to do some operation, verify
+# that testval has not changed, continue to the location at
+# which the next test starts, and verify testval again.
+# This works around platform differences in debuginfo that
+# make looking at the source line unreliable.
+
+# A simple test of next over a throw.
+tbreak_and_cont "Start: first test"
+gdb_test "next" ".*" "next over a throw 1"
+tbreak_and_cont "End: first test"
+verify_testval "pre-check - next over a throw 1" -1
+
+tbreak_and_cont "Start: nested throw"
+verify_testval "post-check - next over a throw 1" 0
+gdb_test "next" ".*" "next over a throw 2"
+tbreak_and_cont "End: nested throw"
+verify_testval "pre-check - next over a throw 2" 0
+
+tbreak_and_cont "Start: step in test"
+verify_testval "post-check - next over a throw 2" 1
+gdb_test "step" "function1().*" "step into function2 1"
+gdb_test "next" ".*" "next over a throw 3"
+tbreak_and_cont "End: step in test"
+verify_testval "pre-check - next over a throw 3" 1
+
+tbreak_and_cont "Start: next past catch"
+verify_testval "post-check - next over a throw 3" 2
+gdb_test "next" ".*" "next past catch"
+tbreak_and_cont "End: next past catch"
+verify_testval "pre-check - next past catch" 2
+
+tbreak_and_cont "Start: rethrow"
+verify_testval "post-check - next past catch" 3
+gdb_test "next" ".*" "next over a throw 4"
+tbreak_and_cont "End: rethrow"
+verify_testval "pre-check - next over a throw 4" 3
+
+tbreak_and_cont "Start: first finish"
+verify_testval "post-check - next over a throw 4" 4
+gdb_test "step" "function1().*" "step into function2 2"
+gdb_test "finish" ".*" "finish 1"
+tbreak_and_cont "End: first finish"
+verify_testval "pre-check - finish 1" 4
+
+tbreak_and_cont "Start: second finish"
+verify_testval "post-check - finish 1" 5
+gdb_test "step" "function1 ().*" "step into finish method"
+gdb_test "finish" ".*" "finish 2"
+tbreak_and_cont "End: second finish"
+verify_testval "pre-check - finish 2" 5
+
+tbreak_and_cont "Start: first until"
+verify_testval "post-check - finish 2" 6
+gdb_test "step" ".*" "step into finish, for until"
+gdb_test "until" ".*" "until with no argument 1"
 set line [gdb_get_line_number "marker for until" $testfile.cc]
+gdb_test "until $line" "function1 ().*" "next past catch 6"
+gdb_test "until" ".*" "until with no argument 2"
+tbreak_and_cont "End: first until"
+verify_testval "pre-check - until 1" 6
 
-gdb_test "until $line" \
-  "function1 ().*" \
-  "next past catch 6"
-
-gdb_test "until" \
-  "catch (...).*" \
-  "until with no argument 2"
-
+tbreak_and_cont "Start: second until"
+verify_testval "post-check - until 1" 7
 set line [gdb_get_line_number "until here" $testfile.cc]
-
-gdb_test "next" \
-  "next_cases.until ().*" \
-  "next past catch 6"
-
-gdb_test "step" \
-  "function1 ().*" \
-  "step into until"
-
-gdb_test "until $line" \
-  "catch (...).*" \
-  "until-over-throw"
-
-gdb_test "next" \
-  "next_cases.until ().*" \
-  "next past catch 7"
-
-gdb_test "step" \
-  "function1 ().*" \
-  "step into until, for advance"
-
-gdb_test "advance $line" \
-  "catch (...).*" \
-  "advance-over-throw"
+gdb_test "step" "function1 ().*" "step into until"
+gdb_test "until $line" ".*" "until-over-throw"
+tbreak_and_cont "End: second until"
+verify_testval "pre-check - until 2" 7
+
+tbreak_and_cont "Start: advance"
+verify_testval "post-check - until 2" 8
+gdb_test "step" "function1 ().*" "step into until, for advance"
+gdb_test "advance $line" ".*" "advance-over-throw"
+tbreak_and_cont "End: advance"
+verify_testval "pre-check - advance" 8
+
+tbreak_and_cont "done"
+verify_testval "post-check - advance" 9


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


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

only message in thread, other threads:[~2010-12-01 21:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-01 21:37 [SCM] archer-pmuldoon-next-over-throw2: Change to work on PPC64 Use lookup_minimal_symbol, not lookup_minimal_symbol_text Use gdbarch_convert_from_func_ptr_addr 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).