From f2a8bc8a74e38b47d3867f20b841186defe4d8fd Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Sat, 15 Dec 2012 02:19:21 +0000 Subject: [PATCH] 2012-12-15 Yao Qi * breakpoint.c (print_one_breakpoint_location): Display the state of 'installed' of each non-pending location of a tracepoint in both CLI and MI. (download_tracepoint_locations): Notify 'breakpoint-modified' observer if any tracepoint location is downloaded. * tracepoint.c (start_tracing): Likewise. (merge_uploaded_tracepoints): Record all modified tracepoints and notify 'breakpoint-modified' observer for them. * NEWS: Mention the change for CLI and MI. gdb/doc: 2012-12-15 Yao Qi * gdb.texinfo (Listing Tracepoints): New item and example about 'installed on target' output. Add more in the example about 'installed on target'. (GDB/MI Breakpoint Commands): Doc about 'installed field. gdb/testsuite: 2012-12-15 Yao Qi * gdb.trace/mi-tracepoint-changed.exp (test_pending_resolved): Check 'installed' field in '=breakpoint-modified'. (test_reconnect): Check 'installed' field in '=breakpoint-modified' and '=breakpoint-created'. * gdb.trace/actions.exp: Update test for 'installed' field. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): (tracepoint_change_loc_2): Likewise. Check 'info tracepoint' display nothing else. * gdb.trace/deltrace.exp: Likewise. * gdb.trace/infotrace.exp: Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_remote): Likewise. * gdb.trace/passcount.exp: Likewise. * gdb.trace/tracecmd.exp: Likewise. * gdb.trace/while-stepping.exp: Likewise. --- gdb/ChangeLog | 13 +++++++++ gdb/NEWS | 6 +++++ gdb/breakpoint.c | 23 ++++++++++++++++ gdb/doc/ChangeLog | 7 +++++ gdb/doc/gdb.texinfo | 22 ++++++++++++--- gdb/testsuite/ChangeLog | 19 +++++++++++++ gdb/testsuite/gdb.trace/actions.exp | 25 +++++++++++++---- gdb/testsuite/gdb.trace/change-loc.exp | 11 +++++--- gdb/testsuite/gdb.trace/deltrace.exp | 22 +++++++++++---- gdb/testsuite/gdb.trace/infotrace.exp | 10 ++++--- gdb/testsuite/gdb.trace/mi-traceframe-changed.exp | 3 ++- gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp | 27 ++++++++++++------- gdb/testsuite/gdb.trace/passcount.exp | 28 +++++++++++++------ gdb/testsuite/gdb.trace/tracecmd.exp | 13 ++++++--- gdb/testsuite/gdb.trace/while-stepping.exp | 3 ++- gdb/tracepoint.c | 33 +++++++++++++++++++++++ 16 files changed, 221 insertions(+), 44 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b2013f4..e8c48c5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,18 @@ 2012-12-15 Yao Qi + * breakpoint.c (print_one_breakpoint_location): Display the + state of 'installed' of each non-pending location of a tracepoint + in both CLI and MI. + (download_tracepoint_locations): Notify 'breakpoint-modified' + observer if any tracepoint location is downloaded. + * tracepoint.c (start_tracing): Likewise. + (merge_uploaded_tracepoints): Record all modified + tracepoints and notify 'breakpoint-modified' observer for them. + + * NEWS: Mention the change for CLI and MI. + +2012-12-15 Yao Qi + * breakpoint.c (download_tracepoint_locations): Iterate over ALL_TRACEPOINTS first and then iterate over locations of each tracepoint. diff --git a/gdb/NEWS b/gdb/NEWS index 775e7d3..52662fc 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -42,6 +42,9 @@ * The command 'forward-search' can now be abbreviated as 'fo'. +* The command 'info tracepoints' can now display 'installed on target' + or 'not installed on target' for each non-pending location of tracepoint. + * New configure options --enable-libmcheck/--disable-libmcheck @@ -105,6 +108,9 @@ show print type typedefs command, to allow pattern filling of memory areas. ** New commands "-catch-load"/"-catch-unload" added for intercepting library load/unload events. + ** The response to breakpoint commands and breakpoint async records + includes an "installed" field containing a boolean state about each + non-pending tracepoint location is whether installed on target or not. * GDB now supports the "mini debuginfo" section, .gnu_debugdata. You must have the LZMA library available when configuring GDB for this diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 59aac72..cde6bf4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6120,6 +6120,25 @@ print_one_breakpoint_location (struct breakpoint *b, ui_out_field_int (uiout, "pass", t->pass_count); ui_out_text (uiout, " \n"); } + + /* Don't display it when tracepoint or tracepoint location is + pending. */ + if (!header_of_multiple && loc != NULL && !loc->shlib_disabled) + { + annotate_field (11); + + if (ui_out_is_mi_like_p (uiout)) + ui_out_field_string (uiout, "installed", + loc->inserted ? "y" : "n"); + else + { + if (loc->inserted) + ui_out_text (uiout, "\t"); + else + ui_out_text (uiout, "\tnot "); + ui_out_text (uiout, "installed on target\n"); + } + } } if (ui_out_is_mi_like_p (uiout) && !part_of_multiple) @@ -12093,6 +12112,7 @@ download_tracepoint_locations (void) { struct bp_location *bl; struct tracepoint *t; + int bp_location_downloaded = 0; if ((b->type == bp_fast_tracepoint ? !may_insert_fast_tracepoints @@ -12112,9 +12132,12 @@ download_tracepoint_locations (void) target_download_tracepoint (bl); bl->inserted = 1; + bp_location_downloaded = 1; } t = (struct tracepoint *) b; t->number_on_target = b->number; + if (bp_location_downloaded) + observer_notify_breakpoint_modified (b); } do_cleanups (old_chain); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index f65e4b7..f2e779b 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2012-12-15 Yao Qi + + * gdb.texinfo (Listing Tracepoints): New item and example about + 'installed on target' output. + Add more in the example about 'installed on target'. + (GDB/MI Breakpoint Commands): Doc about 'installed field. + 2012-12-14 Tom Tromey * gdb.texinfo (SVR4 Process Information): Mention core files. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f96d498..9e80c5b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -11476,6 +11476,9 @@ tracing: @itemize @bullet @item its passcount as given by the @code{passcount @var{n}} command + +@item +the state about installed on target of each location @end itemize @smallexample @@ -11488,6 +11491,15 @@ Num Type Disp Enb Address What collect globfoo2 end pass count 1200 +2 tracepoint keep y + collect $eip +2.1 y 0x0804859c in func4 at change-loc.h:35 + installed on target +2.2 y 0xb7ffc480 in func4 at change-loc.h:35 + installed on target +2.3 y set_tracepoint +3 tracepoint keep y 0x080485b1 in foo at change-loc.c:29 + not installed on target (@value{GDBP}) @end smallexample @@ -28447,17 +28459,19 @@ The result is in the form: ^done,bkpt=@{number="@var{number}",type="@var{type}",disp="del"|"keep", enabled="y"|"n",addr="@var{hex}",func="@var{funcname}",file="@var{filename}", fullname="@var{full_filename}",line="@var{lineno}",[thread="@var{threadno},] -times="@var{times}"@} +times="@var{times}"[,installed="@var{installed}"]@} @end smallexample @noindent where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname} is the name of the function where the breakpoint was inserted, @var{filename} is the name of the source file which contains -this function, @var{lineno} is the source line number within that file -and @var{times} the number of times that the breakpoint has been hit +this function, @var{lineno} is the source line number within that file, +@var{times} the number of times that the breakpoint has been hit (always 0 for -break-insert but may be greater for -break-info or -break-list -which use the same output). +which use the same output), and @var{installed}, which is an optional +boolean, is about the state of each non-pending tracepoint location +installed on target or not. Note: this format is open to change. @c An out-of-band breakpoint instead of part of the result? diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d55a0c3..43a6fa2 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2012-12-15 Yao Qi + + * gdb.trace/mi-tracepoint-changed.exp (test_pending_resolved): Check + 'installed' field in '=breakpoint-modified'. + (test_reconnect): Check 'installed' field in + '=breakpoint-modified' and '=breakpoint-created'. + + * gdb.trace/actions.exp: Update test for 'installed' field. + * gdb.trace/change-loc.exp (tracepoint_change_loc_1): + (tracepoint_change_loc_2): Likewise. + Check 'info tracepoint' display nothing else. + * gdb.trace/deltrace.exp: Likewise. + * gdb.trace/infotrace.exp: Likewise. + * gdb.trace/mi-traceframe-changed.exp (test_tfind_remote): + Likewise. + * gdb.trace/passcount.exp: Likewise. + * gdb.trace/tracecmd.exp: Likewise. + * gdb.trace/while-stepping.exp: Likewise. + 2012-12-14 Tom Tromey * gdb.cp/member-name.exp: New file. diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp index 5e2cb12..c05ee2f 100644 --- a/gdb/testsuite/gdb.trace/actions.exp +++ b/gdb/testsuite/gdb.trace/actions.exp @@ -80,8 +80,11 @@ gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. \[\t \]+collect gdb_char_test. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "5.1c: verify actions set for first tracepoint" gdb_trace_setactions "5.1d: set actions for second tracepoint" \ @@ -92,9 +95,12 @@ gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. \[\t \]+collect gdb_char_test. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. \[\t \]+collect gdb_short_test. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "5.1e: verify actions set for second tracepoint" gdb_trace_setactions "5.2a: set actions for last (default) tracepoint" \ @@ -105,10 +111,13 @@ gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. \[\t \]+collect gdb_char_test. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. \[\t \]+collect gdb_short_test. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_long_test." \ +\[\t \]+collect gdb_long_test. +\[\t \]+not installed on target." \ "5.2b: verify actions set for second tracepoint" # 5.3 replace actions set earlier @@ -121,10 +130,13 @@ gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. \[\t \]+collect gdb_struct1_test. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. \[\t \]+collect gdb_short_test. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_long_test." \ +\[\t \]+collect gdb_long_test. +\[\t \]+not installed on target." \ "5.3b: verify actions set for first tracepoint" # @@ -214,9 +226,12 @@ gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. \[\t \]+teval gdb_char_test. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. \[\t \]+teval \\\$tsv \\\+= 1. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_long_test." \ +\[\t \]+collect gdb_long_test. +\[\t \]+not installed on target." \ "5.10a: verify teval actions set for two tracepoints" diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp index 0064b6f..a17c54c 100644 --- a/gdb/testsuite/gdb.trace/change-loc.exp +++ b/gdb/testsuite/gdb.trace/change-loc.exp @@ -154,7 +154,8 @@ proc tracepoint_change_loc_1 { trace_type } { with_test_prefix "1 $trace_type" { # shlib is unloaded, there are still three locations, but one is pending. gdb_test "info trace" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\.*4\.1.* in func4.*(4\.2.* in func4.*4\.3.* \\[\t \]+set_tracepoint|4\.2.* \\[\t \]+set_tracepoint\r\n4\.3.* in func4).*" \ +\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\.* +4\.1.* in func4.*\tinstalled on target\r\n(4\.2.* in func4.*\tinstalled on target\r\n4\.3.* \\[\t \]+set_tracepoint|4\.2.* \\[\t \]+set_tracepoint.*4\.3.* in func4.*\tinstalled on target).*" \ "tracepoint with two locations (unload)" gdb_test_no_output "tstop" @@ -186,10 +187,11 @@ proc tracepoint_change_loc_2 { trace_type } { with_test_prefix "2 $trace_type" { gdb_trace_setactions "set action for tracepoint" "" \ "collect \$$pcreg" "^$" - # tracepoint has no location information now. + # tracepoint has no location information now. Make sure nothing + # else is displayed. gdb_test "info trace" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*PENDING.*set_tracepoint.*" \ +\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*PENDING.*set_tracepoint\r\n\[\t \]+collect \\$$pcreg\r" \ "single pending tracepoint info (without symbols)" gdb_load ${binfile} @@ -258,7 +260,8 @@ proc tracepoint_change_loc_2 { trace_type } { with_test_prefix "2 $trace_type" { # shlib is unloaded, there are still three locations, but one is pending. gdb_test "info trace" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\.*1\.1.* in func4.*(1\.2.* in func4.*1\.3.* \\[\t \]+set_tracepoint|1\.2.* \\[\t \]+set_tracepoint\r\n1\.3.* in func4).*" \ +\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\.* +1\.1.* in func4.*\tinstalled on target\r\n(1\.2.* in func4.*\tinstalled on target\r\n1\.3.* \\[\t \]+set_tracepoint|1\.2.* \\[\t \]+set_tracepoint\r\n1\.3.* in func4.*\tinstalled on target).*" \ "tracepoint with two locations (unload)" gdb_test_no_output "tstop" diff --git a/gdb/testsuite/gdb.trace/deltrace.exp b/gdb/testsuite/gdb.trace/deltrace.exp index 2423de2..53bbc7f 100644 --- a/gdb/testsuite/gdb.trace/deltrace.exp +++ b/gdb/testsuite/gdb.trace/deltrace.exp @@ -56,8 +56,11 @@ gdb_test "trace $testline1" "Tracepoint \[0-9\]+ at .*" "set tracepoint 3" gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "3.1a: set three tracepoints" gdb_test "delete tracepoints" \ @@ -80,8 +83,11 @@ if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "3.2a: set three tracepoints" #gdb_test_no_output "delete tracepoint $trcpt1" "" @@ -100,7 +106,9 @@ gdb_test_multiple "delete tracepoint $trcpt1" "3.2b: delete first tracepoint" { gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "3.2c: verify delete first tracepoint" #gdb_test_no_output "delete tracepoint $trcpt2" "" @@ -118,7 +126,8 @@ gdb_test_multiple "delete tracepoint $trcpt2" "3.2d: delete second tracepoint" { gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "3.2e: verify delete second tracepoint" #gdb_test_no_output "delete tracepoint $trcpt3" "" @@ -152,8 +161,11 @@ if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "3.3a: set three tracepoints" #gdb_test_no_output "delete tracepoint $trcpt1 $trcpt2 $trcpt3" "" diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp index bdc3830..abb1dc8 100644 --- a/gdb/testsuite/gdb.trace/infotrace.exp +++ b/gdb/testsuite/gdb.trace/infotrace.exp @@ -50,18 +50,22 @@ if { $c_test_num <= 0 || $asm_test_num <= 0 } then { gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+." \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "2.1: info tracepoints (all)" # 2.2 info tracepoint (specific) gdb_test "info tracepoint $c_test_num" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+." \ +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "2.2a: info tracepoint $c_test_num (gdb_c_test)" gdb_test "info tracepoint $asm_test_num" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+." \ +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "2.2b: info tracepoint $asm_test_num (gdb_asm_test)" # 2.3 info tracepoint (invalid tracepoint number) diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp index b587d10..60e7076 100644 --- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp @@ -109,7 +109,8 @@ proc test_tfind_remote { } { with_test_prefix "remote" { mi_gdb_test "-break-insert end" "\\^done.*" "break end" mi_gdb_test "-break-insert -a func2" "\\^done.*" "break func2" - mi_gdb_test "-trace-start" "\\^done.*" "trace start" + mi_gdb_test "-trace-start" "=breakpoint-modified,bkpt={.*installed=\"y\".*}.*\\^done.*" \ + "trace start" mi_execute_to "exec-continue" "breakpoint-hit" end "" ".*" ".*" \ { "" "disp=\"keep\"" } \ diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp index 2913b12..cd38a67 100644 --- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp @@ -133,13 +133,18 @@ proc test_reconnect { } { with_test_prefix "reconnect" { fail "$test: 2" exp_continue } - -re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"main\".*${mi_gdb_prompt}" { + -re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",\[^\n\]+,func=\"main\"\[^\n\]+,installed=\"y\"" { # A tracepoint on main was defined in the stub, not in GDB, # so we should see a =breakpoint-created notification. pass $test } - timeout { - fail $test + } + # Tracepoint on marker is defined. After the sync, we know that + # the tracepoint is in remote stub. Mark it 'installed'. + set test "tracepoint on marker is installed" + gdb_expect { + -re "=breakpoint-modified,bkpt=\{number=\"2\".*,func=\"marker\".*installed=\"y\".*${mi_gdb_prompt}$" { + pass "$test" } } # Check that tracepoint 1 is still pending. @@ -188,18 +193,22 @@ proc test_pending_resolved { } { with_test_prefix "pending resolved" { mi_send_resuming_command "exec-continue" "continuing execution to marker 1" + # It is expected to get two "=breakpoint-modified" notifications. + # Pending tracepoint is resolved. set test "tracepoint on pendfunc2 resolved" gdb_expect { - -re ".*=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\"" { + -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"n\"" { pass "$test" } - -re ".*${mi_gdb_prompt}$" { - fail $test - } - timeout { - fail "$test (timeout)" + } + # Resolved tracepoint is installed. + set test "tracepoint on pendfunc2 installed" + gdb_expect { + -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"y\"" { + pass "$test" } } + mi_expect_stop "breakpoint-hit" "marker" ".*" ".*" ".*" \ {"" "disp=\"keep\""} "continue to marker" diff --git a/gdb/testsuite/gdb.trace/passcount.exp b/gdb/testsuite/gdb.trace/passcount.exp index 42f767a..fffeda2 100644 --- a/gdb/testsuite/gdb.trace/passcount.exp +++ b/gdb/testsuite/gdb.trace/passcount.exp @@ -61,8 +61,11 @@ if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "4.1a: set three tracepoints, passcounts all zero" gdb_test "passcount 2 $trcpt1" \ @@ -72,9 +75,12 @@ gdb_test "passcount 2 $trcpt1" \ gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+pass count 2 .* +\[\t \]+pass count 2 . +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "4.1c: verify 1st tracepoint's passcount set to two" gdb_test "passcount 4 $trcpt2" \ @@ -84,10 +90,13 @@ gdb_test "passcount 4 $trcpt2" \ gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+pass count 2 .* +\[\t \]+pass count 2 . +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+pass count 4 .* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ +\[\t \]+pass count 4 . +\[\t \]+not installed on target. +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "4.1c: verify 2nd tracepoint's passcount set to four" # 4.2 passcount of last (default) tracepoint @@ -181,10 +190,13 @@ gdb_test "passcount 0 $trcpt1" \ gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+pass count 4 .* +\[\t \]+pass count 4 . +\[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+pass count 4 .*" \ +\[\t \]+pass count 4 . +\[\t \]+not installed on target." \ "4.6: set passcount to zero" # 4.7 (test a very large passcount) diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp index b4fc3e2..2b0a96a 100644 --- a/gdb/testsuite/gdb.trace/tracecmd.exp +++ b/gdb/testsuite/gdb.trace/tracecmd.exp @@ -62,7 +62,8 @@ gdb_delete_tracepoints gdb_test "trace $srcfile:$testline2" \ "Tracepoint $decimal at $hex: file.*$srcfile, line $testline2." \ "1.1a: set tracepoint at sourceline" -gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2" \ +gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2. +\[\t \]+not installed on target." \ "1.1b: trace sourcefile:line" # 1.2 trace invalid source line @@ -85,7 +86,8 @@ gdb_delete_tracepoints gdb_test "trace gdb_recursion_test" \ "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \ "1.4a: trace function by name" -gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1" \ +gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1. +\[\t \]+not installed on target." \ "1.4b: trace function by name" # 1.5 trace non-existant function @@ -122,7 +124,8 @@ gdb_delete_tracepoints gdb_test "trace \*gdb_recursion_test" \ "Tracepoint $decimal at .*$c_test_addr.*" \ "1.7a: trace at function label (before prologue)" -gdb_test "info trace" "$c_test_addr.*in gdb_recursion_test.*:$baseline" \ +gdb_test "info trace" "$c_test_addr.*in gdb_recursion_test.*:$baseline. +\[\t \]+not installed on target." \ "1.7b: verify trace at specific address" # 1.8 trace at invalid address @@ -139,7 +142,9 @@ gdb_delete_tracepoints gdb_test "trace gdb_recursion_test if q1 > 0" \ "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \ "1.11a: conditional tracepoint" -gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1.*trace only if q1 > 0" \ +gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1. +\[\t \]+trace only if q1 > 0. +\[\t \]+not installed on target." \ "1.11b: verify conditional tracepoint" # 1.12 set tracepoint in prologue diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp index 5d8e066..f926d75 100644 --- a/gdb/testsuite/gdb.trace/while-stepping.exp +++ b/gdb/testsuite/gdb.trace/while-stepping.exp @@ -49,7 +49,8 @@ if { $trcpt1 <= 0 } then { gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. +\[\t \]+not installed on target." \ "5.12: set a tracepoint, stepcount is zero" set stepcount 12 diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 912341a..f61ede7 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1767,6 +1767,7 @@ start_tracing (char *notes) { struct tracepoint *t = (struct tracepoint *) b; struct bp_location *loc; + int bp_location_downloaded = 0; /* Clear `inserted' flag. */ for (loc = b->loc; loc; loc = loc->next) @@ -1788,6 +1789,7 @@ start_tracing (char *notes) target_download_tracepoint (loc); loc->inserted = 1; + bp_location_downloaded = 1; } t->number_on_target = b->number; @@ -1795,6 +1797,9 @@ start_tracing (char *notes) for (loc = b->loc; loc; loc = loc->next) if (loc->probe != NULL) loc->probe->pops->set_semaphore (loc->probe, loc->gdbarch); + + if (bp_location_downloaded) + observer_notify_breakpoint_modified (b); } VEC_free (breakpoint_p, tp_vec); @@ -3470,6 +3475,10 @@ void merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) { struct uploaded_tp *utp; + /* A set of tracepoints which are modified. */ + VEC(breakpoint_p) *modified_tp = NULL; + int ix; + struct breakpoint *b; /* Look for GDB tracepoints that match up with our uploaded versions. */ for (utp = *uploaded_tps; utp; utp = utp->next) @@ -3480,6 +3489,8 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) loc = find_matching_tracepoint_location (utp); if (loc) { + int found = 0; + /* Mark this location as already inserted. */ loc->inserted = 1; t = (struct tracepoint *) loc->owner; @@ -3487,6 +3498,22 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) "as target's tracepoint %d at %s.\n"), loc->owner->number, utp->number, paddress (loc->gdbarch, utp->addr)); + + /* The tracepoint LOC->owner was modified (the location LOC + was marked as inserted in the target). Save it in + MODIFIED_TP if not there yet. The 'breakpoint-modified' + observers will be notified later once for each tracepoint + saved in MODIFIED_TP. */ + for (ix = 0; + VEC_iterate (breakpoint_p, modified_tp, ix, b); + ix++) + if (b == loc->owner) + { + found = 1; + break; + } + if (!found) + VEC_safe_push (breakpoint_p, modified_tp, loc->owner); } else { @@ -3509,6 +3536,12 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) t->number_on_target = utp->number; } + /* Notify 'breakpoint-modified' observer that at least one of B's + locations was changed. */ + for (ix = 0; VEC_iterate (breakpoint_p, modified_tp, ix, b); ix++) + observer_notify_breakpoint_modified (b); + + VEC_free (breakpoint_p, modified_tp); free_uploaded_tps (uploaded_tps); } -- 2.7.4