public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix gdb.trace/ ftrace tests
Date: Wed, 06 Dec 2017 15:17:00 -0000	[thread overview]
Message-ID: <1512573424-26651-1-git-send-email-palves@redhat.com> (raw)

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(-)

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"
 
-- 
2.5.5

             reply	other threads:[~2017-12-06 15:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 15:17 Pedro Alves [this message]
2017-12-06 15:58 ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1512573424-26651-1-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).