This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] XFAIL gdb.cp/mb-inline.exp conditionaly


In mb-inline.exp, breakpoint 1.2 is disabled, re-run program, and make
sure breakpoint 1.2 is still disabled and program will not hit it.  The
pre-condition is new inferior created by re-run is loaded at the exactly
same address as previous one.  However, it is not true on some systems,
such as uclinux.

On uclinux, new inferior is created on the different address, so status
of breakpoint location (enabled or disabled) will not be kept during
breakpoint updates.  breakpoint 1.2 become enabled, instead of disabled.
 This will make this FAIL,

  FAIL: gdb.cp/mb-inline.exp: continue with disabled breakpoint 1.2

This patch is to address this issue.  After this patch, in my uclinux
port, the test result is like this,

# of expected passes            9
# of expected failures          1

but, some times, we can get 10 PASSes, because the new inferior may be
created/loaded on the same address as previous one.

Note that I also considered to use setup_xfail for uclinux target, but
we may get a XPASS, so I didn't write patch in that way.

OK for mainline?

-- 
Yao (éå)
2011-06-15  Yao Qi  <yao@codesourcery.com>

	gdb/testsuite/
	* gdb.cp/mb-inline.exp: Set breakpoint on function marker.
	XFAIL for uclinux.
	* gdb.cp/mb-inline1.cc (marker): New.

diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp
index 86cb5ba..62708b0 100644
--- a/gdb/testsuite/gdb.cp/mb-inline.exp
+++ b/gdb/testsuite/gdb.cp/mb-inline.exp
@@ -101,7 +101,24 @@ gdb_expect {
     }
 }
 
-gdb_continue_to_end "disabled breakpoint 1.2"
+
+gdb_test "break marker" \
+    "Breakpoint.*at.* file .*, line.*" \
+    "set breakpoint on marker"
+
+gdb_test_multiple "continue" "continue with disabled breakpoint 1.2" {
+    -re "Breakpoint \[0-9\]+,.*marker.*$gdb_prompt $" {
+       pass "continue with disabled breakpoint 1.2"
+    }
+    -re "Breakpoint \[0-9\]+,.*foo \\(i=1\\).*$gdb_prompt $" {
+       # When inferior is restarted, breakpoint locations will be updated.
+       # On uclinux, it is not guaranteed that new inferior is located the
+       # same address as previous one, so status/state of breakpoint location
+       # will loose.
+       setup_xfail "*-*-uclinux*"
+       fail "continue with disabled breakpoint 1.2"
+    }
+}
 
 # Make sure we can set a breakpoint on a source statement that spans
 # multiple lines.
diff --git a/gdb/testsuite/gdb.cp/mb-inline1.cc b/gdb/testsuite/gdb.cp/mb-inline1.cc
index 3259002..86dc697 100644
--- a/gdb/testsuite/gdb.cp/mb-inline1.cc
+++ b/gdb/testsuite/gdb.cp/mb-inline1.cc
@@ -26,10 +26,15 @@ afn ()
   return foo (0) + multi_line_foo (0);
 }
 
+void
+marker ()
+{}
+
 int
 main ()
 {
   int a = afn ();
   int b = bfn ();
+  marker ();
   return a * b;
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]