2012-11-09 Yao Qi <yao@codesourcery.com>

* breakpoint.c: Declare set_tracepoint_count.
        (install_breakpoint): Call set_tracepoint_count if B is a
        tracepoint.
        (trace_command): Don't call set_tracepoint_count.  Re-indent.
        (strace_command, ftrace_command):
        (create_tracepoint_from_upload): Likewise.

gdb/testsuite:

2012-11-09  Yao Qi  <yao@codesourcery.com>

        * gdb.mi/mi-break.exp (test_abreak_creation): New procedure.
        (top level): Call it
This commit is contained in:
Yao Qi 2012-11-09 07:21:03 +00:00
parent 8506d139b8
commit 558a9d8255
4 changed files with 71 additions and 38 deletions

View File

@ -1,3 +1,12 @@
2012-11-09 Yao Qi <yao@codesourcery.com>
* breakpoint.c: Declare set_tracepoint_count.
(install_breakpoint): Call set_tracepoint_count if B is a
tracepoint.
(trace_command): Don't call set_tracepoint_count. Re-indent.
(strace_command, ftrace_command):
(create_tracepoint_from_upload): Likewise.
2012-11-09 Pedro Alves <palves@redhat.com> 2012-11-09 Pedro Alves <palves@redhat.com>
* gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro. * gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro.

View File

@ -261,6 +261,8 @@ static void disable_trace_command (char *, int);
static void trace_pass_command (char *, int); static void trace_pass_command (char *, int);
static void set_tracepoint_count (int num);
static int is_masked_watchpoint (const struct breakpoint *b); static int is_masked_watchpoint (const struct breakpoint *b);
static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address); static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address);
@ -8319,6 +8321,8 @@ install_breakpoint (int internal, struct breakpoint *b, int update_gll)
{ {
add_to_breakpoint_chain (b); add_to_breakpoint_chain (b);
set_breakpoint_number (internal, b); set_breakpoint_number (internal, b);
if (is_tracepoint (b))
set_tracepoint_count (breakpoint_count);
if (!internal) if (!internal)
mention (b); mention (b);
observer_notify_breakpoint_created (b); observer_notify_breakpoint_created (b);
@ -14999,35 +15003,33 @@ trace_command (char *arg, int from_tty)
else else
ops = &tracepoint_breakpoint_ops; ops = &tracepoint_breakpoint_ops;
if (create_breakpoint (get_current_arch (), create_breakpoint (get_current_arch (),
arg, arg,
NULL, 0, NULL, 1 /* parse arg */, NULL, 0, NULL, 1 /* parse arg */,
0 /* tempflag */, 0 /* tempflag */,
bp_tracepoint /* type_wanted */, bp_tracepoint /* type_wanted */,
0 /* Ignore count */, 0 /* Ignore count */,
pending_break_support, pending_break_support,
ops, ops,
from_tty, from_tty,
1 /* enabled */, 1 /* enabled */,
0 /* internal */, 0)) 0 /* internal */, 0);
set_tracepoint_count (breakpoint_count);
} }
static void static void
ftrace_command (char *arg, int from_tty) ftrace_command (char *arg, int from_tty)
{ {
if (create_breakpoint (get_current_arch (), create_breakpoint (get_current_arch (),
arg, arg,
NULL, 0, NULL, 1 /* parse arg */, NULL, 0, NULL, 1 /* parse arg */,
0 /* tempflag */, 0 /* tempflag */,
bp_fast_tracepoint /* type_wanted */, bp_fast_tracepoint /* type_wanted */,
0 /* Ignore count */, 0 /* Ignore count */,
pending_break_support, pending_break_support,
&tracepoint_breakpoint_ops, &tracepoint_breakpoint_ops,
from_tty, from_tty,
1 /* enabled */, 1 /* enabled */,
0 /* internal */, 0)) 0 /* internal */, 0);
set_tracepoint_count (breakpoint_count);
} }
/* strace command implementation. Creates a static tracepoint. */ /* strace command implementation. Creates a static tracepoint. */
@ -15044,18 +15046,17 @@ strace_command (char *arg, int from_tty)
else else
ops = &tracepoint_breakpoint_ops; ops = &tracepoint_breakpoint_ops;
if (create_breakpoint (get_current_arch (), create_breakpoint (get_current_arch (),
arg, arg,
NULL, 0, NULL, 1 /* parse arg */, NULL, 0, NULL, 1 /* parse arg */,
0 /* tempflag */, 0 /* tempflag */,
bp_static_tracepoint /* type_wanted */, bp_static_tracepoint /* type_wanted */,
0 /* Ignore count */, 0 /* Ignore count */,
pending_break_support, pending_break_support,
ops, ops,
from_tty, from_tty,
1 /* enabled */, 1 /* enabled */,
0 /* internal */, 0)) 0 /* internal */, 0);
set_tracepoint_count (breakpoint_count);
} }
/* Set up a fake reader function that gets command lines from a linked /* Set up a fake reader function that gets command lines from a linked
@ -15124,8 +15125,6 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
CREATE_BREAKPOINT_FLAGS_INSERTED)) CREATE_BREAKPOINT_FLAGS_INSERTED))
return NULL; return NULL;
set_tracepoint_count (breakpoint_count);
/* Get the tracepoint we just created. */ /* Get the tracepoint we just created. */
tp = get_tracepoint (tracepoint_count); tp = get_tracepoint (tracepoint_count);
gdb_assert (tp != NULL); gdb_assert (tp != NULL);

View File

@ -1,3 +1,8 @@
2012-11-09 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-break.exp (test_abreak_creation): New procedure.
(top level): Call it.
2012-11-09 Yao Qi <yao@codesourcery.com> 2012-11-09 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-watch.exp (test_rwatch_creation_and_listing): Fix * gdb.mi/mi-watch.exp (test_rwatch_creation_and_listing): Fix

View File

@ -150,6 +150,24 @@ proc test_rbreak_creation_and_listing {} {
"delete temp breakpoints" "delete temp breakpoints"
} }
proc test_abreak_creation {} {
mi_create_varobj tpnum \$tpnum "create local variable tpnum"
# Test that $tpnum is not set before creating a tracepoint.
mi_gdb_test "521-var-evaluate-expression tpnum" \
"521\\^done,value=\"void\"" "eval tpnum before tracepoint"
mi_gdb_test "522-break-insert -a main" \
"522\\^done,bkpt=\{number=\"10\",type=\"tracepoint\".*\"\}" \
"break-insert -a operation"
mi_gdb_test "523-var-update tpnum" \
"523\\^done,changelist=\\\[\{name=\"tpnum\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update tpnum"
# Test that $tpnum is updated after creating a tracepoint.
mi_gdb_test "524-var-evaluate-expression tpnum" \
"524\\^done,value=\"10\"" "eval tpnum after tracepoint"
}
proc test_ignore_count {} { proc test_ignore_count {} {
global mi_gdb_prompt global mi_gdb_prompt
global line_callme_body global line_callme_body
@ -256,5 +274,7 @@ test_disabled_creation
test_breakpoint_commands test_breakpoint_commands
test_abreak_creation
mi_gdb_exit mi_gdb_exit
return 0 return 0