gdb-comm.exp sets breakpoints on exit and abort before load. The problem is that GDB tries to skip prologue according to what it reads from memory, which might contain random data since the executable has not been loaded into memory. In my case, sometimes skip_prologue might skip one or two more instructions, which happens to be an exception instruction and will trap the processor into an exception event loop after running the executable before hit the breakpoints. The attached patch changes gdb-comm.exp to set breakpoints after load.

Thanks,
Jie
2010-01-19  Jie Zhang  <jie.zh...@analog.com>

	* config/gdb-comm.exp (gdb_comm_load): Set breakpoints after load.


diff --git a/config/gdb-comm.exp b/config/gdb-comm.exp
index affa61a..f8a677f 100644
--- a/config/gdb-comm.exp
+++ b/config/gdb-comm.exp
@@ -308,16 +308,6 @@ proc gdb_comm_load { dest prog args } {
 	}
     }
 
-    # Now set up breakpoints in exit, _exit, and abort.  These
-    # are used to determine if a c-torture test passed or failed.  More
-    # work would be necessary for things like the g++ testsuite which
-    # use printf to indicate pass/fail status.
-
-    if { [gdb_comm_add_breakpoint _exit] != "" } {
-	gdb_comm_add_breakpoint exit
-    }
-    gdb_comm_add_breakpoint abort
-
     set protocol [board_info $dest gdb_protocol]
     if {[board_info $dest exists gdb_serial]} {
 	set targetname [board_info $dest gdb_serial]
@@ -405,6 +395,16 @@ proc gdb_comm_load { dest prog args } {
 	}
     }
 
+    # Now set up breakpoints in exit, _exit, and abort.  These
+    # are used to determine if a c-torture test passed or failed.  More
+    # work would be necessary for things like the g++ testsuite which
+    # use printf to indicate pass/fail status.
+
+    if { [gdb_comm_add_breakpoint _exit] != "" } {
+	gdb_comm_add_breakpoint exit
+    }
+    gdb_comm_add_breakpoint abort
+
     set output ""
     
     # Now start up the program and look for our magic breakpoints.
_______________________________________________
DejaGnu mailing list
DejaGnu@gnu.org
http://lists.gnu.org/mailman/listinfo/dejagnu

Reply via email to