Patchwork Fix gdb.trace/ ftrace tests

login
register
mail settings
Submitter Pedro Alves
Date Dec. 6, 2017, 3:17 p.m.
Message ID <1512573424-26651-1-git-send-email-palves@redhat.com>
Download mbox | patch
Permalink /patch/24759/
State New
Headers show

Comments

Pedro Alves - Dec. 6, 2017, 3:17 p.m.
Several gdb.trace/ ftrace tests are currently broken due to a curious
combination:

 #1 - the tests do "b end"

 #2 - IPA started using std::vector recently, since tdescs started using it.

 #3 - with the new C++ wildmatching support, and "b end" sets a breakpoint on

    std::vector<reg*>::end()

   which is called from within gdb_collect, the function that is
   injected in the inferior to collect fast tracepoints.

  Thread 1 "ftrace" hit Breakpoint 1, main () at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/testsuite/gdb.trace/ftrace.c:50
  50        begin ();
  (gdb) b end
  Breakpoint 2 at 0x40069b: end. (12 locations)
  (gdb) ftrace set_point
  Fast tracepoint 3 at 0x40068b: file /home/pedro/gdb/mygit/cxx-convertion/src/gdb/testsuite/gdb.trace/ftrace.c, line 29.
  (gdb) tstart
  (gdb) c
  Continuing.

  Thread 1 "ftrace" hit Breakpoint 2, std::vector<reg*, std::allocator<reg*> >::end (this=0x613e00) at /usr/include/c++/5.3.1/bits/stl_vector.h:566
  566           { return iterator(this->_M_impl._M_finish); }
  (gdb) bt
  #0  0x00007ffff7b10bc0 in std::vector<reg*, std::allocator<reg*> >::end() (this=0x613e00) at /usr/include/c++/5.3.1/bits/stl_vector.h:566
  #1  0x00007ffff7b1082c in init_target_desc(target_desc*) (tdesc=0x613e00) at src/gdb/gdbserver/tdesc.c:27
  #2  0x00007ffff7b14048 in amd64_linux_read_description(unsigned long, bool) (xcr0=7, is_x32=false)
      at src/gdb/gdbserver/linux-x86-tdesc.c:127
  #3  0x00007ffff7b13e0b in get_ipa_tdesc(int) (idx=2) at src/gdb/gdbserver/linux-amd64-ipa.c:208
  #4  0x00007ffff7b12d87 in gdb_collect(tracepoint*, unsigned char*) (tpoint=0x7ffff65c6010, regs=0x7fffffffd830 "\213\006@")
      at src/gdb/gdbserver/tracepoint.c:5800
  #5  0x000000004000007a in  ()
  #6  0x00007ffff65c6010 in  ()
  #7  0x00007ffff7fbf740 in  ()
  #8  0x0000003100000007 in  ()
  #9  0x000000000040068b in marker (anarg=32767) at src/gdb/testsuite/gdb.trace/ftrace.c:28
  #10 0x00000000004006c3 in main () at src/gdb/testsuite/gdb.trace/ftrace.c:54

(I'm wondering whether we could somehow make gdb just not set user
breakpoints in the IPA (at least by default).  Maybe add a new "do not
debug me" attribute to shared libraries, and then have gdbserver
report it for the IPA dso.  (To avoid hardcoding the name of the IPA
library in GDB).  But that's more than I can handle right now.)

gdb/testsuite/ChangeLog:
2017-12-06  Pedro Alves  <palves@redhat.com>

	* gdb.trace/ftrace-lock.exp: Pass "-q" to break/ftrace.
	* gdb.trace/ftrace.exp (test_fast_tracepoints): Likewise.
	* gdb.trace/trace-break.exp (break_trace_same_addr_1)
	(break_trace_same_addr_2, break_trace_same_addr_3)
	(break_trace_same_addr_4, break_trace_same_addr_5)
	(break_trace_same_addr_6): Pass "-q" to break/trace/ftrace.
	* gdb.trace/trace-condition.exp (test_tracepoints): Likewise.
	* gdb.trace/trace-mt.exp (break_trace_same_addr): Likewise.
---
 gdb/testsuite/gdb.trace/ftrace-lock.exp     |  4 +--
 gdb/testsuite/gdb.trace/ftrace.exp          |  6 ++--
 gdb/testsuite/gdb.trace/trace-break.exp     | 47 +++++++++++++++--------------
 gdb/testsuite/gdb.trace/trace-condition.exp |  6 ++--
 gdb/testsuite/gdb.trace/trace-mt.exp        |  6 ++--
 5 files changed, 35 insertions(+), 34 deletions(-)
Yao Qi - Dec. 6, 2017, 3:58 p.m.
Pedro Alves <palves@redhat.com> writes:

> gdb/testsuite/ChangeLog:
> 2017-12-06  Pedro Alves  <palves@redhat.com>
>
> 	* gdb.trace/ftrace-lock.exp: Pass "-q" to break/ftrace.
> 	* gdb.trace/ftrace.exp (test_fast_tracepoints): Likewise.
> 	* gdb.trace/trace-break.exp (break_trace_same_addr_1)
> 	(break_trace_same_addr_2, break_trace_same_addr_3)
> 	(break_trace_same_addr_4, break_trace_same_addr_5)
> 	(break_trace_same_addr_6): Pass "-q" to break/trace/ftrace.
> 	* gdb.trace/trace-condition.exp (test_tracepoints): Likewise.
> 	* gdb.trace/trace-mt.exp (break_trace_same_addr): Likewise.

Patch is good to me.

Patch

diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.exp b/gdb/testsuite/gdb.trace/ftrace-lock.exp
index 7bb9e42..7dab6c0 100644
--- a/gdb/testsuite/gdb.trace/ftrace-lock.exp
+++ b/gdb/testsuite/gdb.trace/ftrace-lock.exp
@@ -69,8 +69,8 @@  if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 }
     return 1
 }
 
-gdb_test "break end" ""
-gdb_test "break fail" ""
+gdb_test "break -q end" ""
+gdb_test "break -q fail" ""
 
 gdb_test "ftrace set_point" "Fast tracepoint .*" \
     "fast tracepoint at a long insn"
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index b862680..73bb6cf 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -77,13 +77,13 @@  proc test_fast_tracepoints {} {
 
     set fourgood 0
 
-    gdb_test "break begin" ".*" ""
+    gdb_test "break -q begin" ".*" ""
 
-    gdb_test "break end" ".*" ""
+    gdb_test "break -q end" ".*" ""
 
     gdb_test "print gdb_agent_gdb_trampoline_buffer_error" ".*" ""
 
-    gdb_test "ftrace set_point" "Fast tracepoint .*" \
+    gdb_test "ftrace -q set_point" "Fast tracepoint .*" \
         "fast tracepoint at a long insn"
 
     gdb_trace_setactions "collect at set_point: define actions" \
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 6770343..6e9d675 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -53,10 +53,10 @@  proc break_trace_same_addr_1 { trace_type option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q end" "Breakpoint \[0-9\] at $hex: file.*"
 
-    gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q set_point" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "${trace_type} -q set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
 
     gdb_test_no_output "tstart"
 
@@ -88,13 +88,13 @@  proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q end" "Breakpoint \[0-9\] at $hex: file.*"
 
-    gdb_test "${trace_type1} set_point" \
+    gdb_test "${trace_type1} -q set_point" \
 	"\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	"${trace_type1} set_point (1)"
 
-    gdb_test "${trace_type2} set_point" \
+    gdb_test "${trace_type2} -q set_point" \
 	"\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	"${trace_type2} set_point (2)"
 
@@ -126,11 +126,11 @@  proc break_trace_same_addr_3 { trace_type option } \
     }
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
-    gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q marker" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q end" "Breakpoint \[0-9\] at $hex: file.*"
 
-    gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q set_point" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "${trace_type} -q set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
 
     gdb_test_no_output "tstart"
 
@@ -164,10 +164,10 @@  proc break_trace_same_addr_4 { trace_type option } \
     }
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
-    gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q marker" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q end" "Breakpoint \[0-9\] at $hex: file.*"
 
-    gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q set_point" "Breakpoint \[0-9\] at $hex: file.*"
     gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
 
     gdb_test "continue" "Continuing\\.\[ \r\n\]+(Thread .* hit )?Breakpoint.*" \
@@ -207,14 +207,14 @@  proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
 	return -1
     }
 
-    gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q marker" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q end" "Breakpoint \[0-9\] at $hex: file.*"
 
-    gdb_test "${trace1} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
+    gdb_test "${trace1} -q set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	"${trace1} set_point 1"
     gdb_trace_setactions "set action for tracepoint 1" "" \
 	"collect \$$pcreg" "^$"
-    gdb_test "${trace2} after_set_point" \
+    gdb_test "${trace2} -q after_set_point" \
 	"\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	"${trace2} after_set_point 1"
 
@@ -227,10 +227,11 @@  proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
 	"continue to marker"
 
     if [string equal $trace3_at_first_loc "1"] {
-	gdb_test "${trace3} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
+	gdb_test "${trace3} -q set_point" \
+	    "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	    "${trace3} set_point 2"
     } else {
-	gdb_test "${trace3} after_set_point" \
+	gdb_test "${trace3} -q after_set_point" \
 	    "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	    "${trace2} after_set_point 2"
     }
@@ -281,17 +282,17 @@  proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
 	return -1
     }
 
-    gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q marker" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q end" "Breakpoint \[0-9\] at $hex: file.*"
 
     gdb_test "continue" "Continuing\\.\[ \r\n\]+(Thread .* hit )?Breakpoint.*" \
 	"continue to marker"
 
-    gdb_test "${trace1} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
+    gdb_test "${trace1} -q set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	"${trace1} set_point 1"
     gdb_trace_setactions "set action for tracepoint 1" "" \
 	"collect \$$pcreg" "^$"
-    gdb_test "${trace2} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
+    gdb_test "${trace2} -q set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
     	"${trace2} set_point 2"
     gdb_trace_setactions "set action for tracepoint 2" "" \
 	"collect \$$spreg" "^$"
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index ec8b1fc..af24069 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -71,13 +71,13 @@  proc test_tracepoints { trace_command condition num_frames { kfail_proc 0 } } {
 	return 0
     }
 
-    gdb_test "break begin" ".*" ""
+    gdb_test "break -q begin" ".*" ""
 
-    gdb_test "break end" ".*" ""
+    gdb_test "break -q end" ".*" ""
 
     with_test_prefix "${trace_command}: ${condition}" {
 
-	gdb_test "${trace_command} set_point if ${condition}" \
+	gdb_test "${trace_command} -q set_point if ${condition}" \
 	    "\(Fast t|T\)racepoint .*" \
 	    "set tracepoint"
 
diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace/trace-mt.exp
index c805145..bdc1630 100644
--- a/gdb/testsuite/gdb.trace/trace-mt.exp
+++ b/gdb/testsuite/gdb.trace/trace-mt.exp
@@ -81,10 +81,10 @@  proc break_trace_same_addr { trace_type option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q end" "Breakpoint \[0-9\] at $hex: file.*"
 
-    gdb_test "break set_point1" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "${trace_type} set_point1" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
+    gdb_test "break -q set_point1" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "${trace_type} -q set_point1" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
 
     gdb_test_no_output "tstart"