aboutsummaryrefslogtreecommitdiff
path: root/gdb/tracepoint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-03-21 16:09:27 +0000
committerTom Tromey <tromey@redhat.com>2013-03-21 16:09:27 +0000
commit92bc6a206434a8b6922846d064e9c701a5a10a0e (patch)
tree028fd4cec6f31f542d202e4294faa70a66383abd /gdb/tracepoint.c
parent81f5558e3d93654ed79b6ea28850a4798ea1404f (diff)
downloadgdb-92bc6a206434a8b6922846d064e9c701a5a10a0e.zip
gdb-92bc6a206434a8b6922846d064e9c701a5a10a0e.tar.gz
gdb-92bc6a206434a8b6922846d064e9c701a5a10a0e.tar.bz2
* tracepoint.h (decode_agent_options): Add 'trace_string'
argument. * tracepoint.c (decode_agent_options): Add 'trace_string' argument. (validate_actionline): Update. (collect_symbol): Add 'trace_string' argument. (struct add_local_symbols_data) <trace_string>: New field. (do_collect_symbol): Update. (add_local_symbols): Add 'trace_string' argument. (encode_actions_1): Update. (trace_dump_actions): Update. * dwarf2loc.c (access_memory): Update. * ax.h (struct agent_expr) <tracing, trace_string>: New fields. * ax-general.c (new_agent_expr): Update. * ax-gdb.h (gen_trace_for_expr, gen_trace_for_var) (gen_trace_for_return_address): Add argument. (trace_kludge, trace_string_kludge): Remove. * ax-gdb.c (trace_kludge, trace_string_kludge): Remove. (gen_traced_pop, gen_fetch, gen_bitfield_ref, gen_expr): Update. (gen_trace_for_var): Add 'trace_string' argument. (gen_trace_for_expr, gen_trace_for_return_address): Likewise. (gen_printf, agent_eval_command_one): Update.
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r--gdb/tracepoint.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 66533f7..9a2425b 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -612,10 +612,12 @@ teval_pseudocommand (char *args, int from_tty)
/* Parse any collection options, such as /s for strings. */
const char *
-decode_agent_options (const char *exp)
+decode_agent_options (const char *exp, int *trace_string)
{
struct value_print_options opts;
+ *trace_string = 0;
+
if (*exp != '/')
return exp;
@@ -631,10 +633,10 @@ decode_agent_options (const char *exp)
/* Allow an optional decimal number giving an explicit maximum
string length, defaulting it to the "print elements" value;
so "collect/s80 mystr" gets at most 80 bytes of string. */
- trace_string_kludge = opts.print_max;
+ *trace_string = opts.print_max;
exp++;
if (*exp >= '0' && *exp <= '9')
- trace_string_kludge = atoi (exp);
+ *trace_string = atoi (exp);
while (*exp >= '0' && *exp <= '9')
exp++;
}
@@ -731,9 +733,10 @@ validate_actionline (const char *line, struct breakpoint *b)
if (cmd_cfunc_eq (c, collect_pseudocommand))
{
- trace_string_kludge = 0;
+ int trace_string = 0;
+
if (*p == '/')
- p = decode_agent_options (p);
+ p = decode_agent_options (p, &trace_string);
do
{ /* Repeat over a comma-separated list. */
@@ -782,7 +785,7 @@ validate_actionline (const char *line, struct breakpoint *b)
/* We have something to collect, make sure that the expr to
bytecode translator can handle it and that it's not too
long. */
- aexpr = gen_trace_for_expr (loc->address, exp);
+ aexpr = gen_trace_for_expr (loc->address, exp, trace_string);
make_cleanup_free_agent_expr (aexpr);
if (aexpr->len > MAX_AGENT_EXPR_LEN)
@@ -989,7 +992,8 @@ collect_symbol (struct collection_list *collect,
struct symbol *sym,
struct gdbarch *gdbarch,
long frame_regno, long frame_offset,
- CORE_ADDR scope)
+ CORE_ADDR scope,
+ int trace_string)
{
unsigned long len;
unsigned int reg;
@@ -1100,7 +1104,7 @@ collect_symbol (struct collection_list *collect,
struct agent_expr *aexpr;
struct cleanup *old_chain1 = NULL;
- aexpr = gen_trace_for_var (scope, gdbarch, sym);
+ aexpr = gen_trace_for_var (scope, gdbarch, sym, trace_string);
/* It can happen that the symbol is recorded as a computed
location, but it's been optimized away and doesn't actually
@@ -1153,6 +1157,7 @@ struct add_local_symbols_data
long frame_regno;
long frame_offset;
int count;
+ int trace_string;
};
/* The callback for the locals and args iterators. */
@@ -1165,7 +1170,7 @@ do_collect_symbol (const char *print_name,
struct add_local_symbols_data *p = cb_data;
collect_symbol (p->collect, sym, p->gdbarch, p->frame_regno,
- p->frame_offset, p->pc);
+ p->frame_offset, p->pc, p->trace_string);
p->count++;
}
@@ -1173,7 +1178,8 @@ do_collect_symbol (const char *print_name,
static void
add_local_symbols (struct collection_list *collect,
struct gdbarch *gdbarch, CORE_ADDR pc,
- long frame_regno, long frame_offset, int type)
+ long frame_regno, long frame_offset, int type,
+ int trace_string)
{
struct block *block;
struct add_local_symbols_data cb_data;
@@ -1184,6 +1190,7 @@ add_local_symbols (struct collection_list *collect,
cb_data.frame_regno = frame_regno;
cb_data.frame_offset = frame_offset;
cb_data.count = 0;
+ cb_data.trace_string = trace_string;
if (type == 'L')
{
@@ -1391,9 +1398,10 @@ encode_actions_1 (struct command_line *action,
if (cmd_cfunc_eq (cmd, collect_pseudocommand))
{
- trace_string_kludge = 0;
+ int trace_string = 0;
+
if (*action_exp == '/')
- action_exp = decode_agent_options (action_exp);
+ action_exp = decode_agent_options (action_exp, &trace_string);
do
{ /* Repeat over a comma-separated list. */
@@ -1413,7 +1421,8 @@ encode_actions_1 (struct command_line *action,
tloc->address,
frame_reg,
frame_offset,
- 'A');
+ 'A',
+ trace_string);
action_exp = strchr (action_exp, ','); /* more? */
}
else if (0 == strncasecmp ("$loc", action_exp, 4))
@@ -1423,7 +1432,8 @@ encode_actions_1 (struct command_line *action,
tloc->address,
frame_reg,
frame_offset,
- 'L');
+ 'L',
+ trace_string);
action_exp = strchr (action_exp, ','); /* more? */
}
else if (0 == strncasecmp ("$_ret", action_exp, 5))
@@ -1431,7 +1441,8 @@ encode_actions_1 (struct command_line *action,
struct cleanup *old_chain1 = NULL;
aexpr = gen_trace_for_return_address (tloc->address,
- tloc->gdbarch);
+ tloc->gdbarch,
+ trace_string);
old_chain1 = make_cleanup_free_agent_expr (aexpr);
@@ -1512,11 +1523,13 @@ encode_actions_1 (struct command_line *action,
tloc->gdbarch,
frame_reg,
frame_offset,
- tloc->address);
+ tloc->address,
+ trace_string);
break;
default: /* Full-fledged expression. */
- aexpr = gen_trace_for_expr (tloc->address, exp);
+ aexpr = gen_trace_for_expr (tloc->address, exp,
+ trace_string);
old_chain1 = make_cleanup_free_agent_expr (aexpr);
@@ -2846,9 +2859,10 @@ trace_dump_actions (struct command_line *action,
char *cmd = NULL;
struct cleanup *old_chain
= make_cleanup (free_current_contents, &cmd);
+ int trace_string = 0;
if (*action_exp == '/')
- action_exp = decode_agent_options (action_exp);
+ action_exp = decode_agent_options (action_exp, &trace_string);
do
{ /* Repeat over a comma-separated list. */