From 8d6476c7112119b57df78b67f2de8e3d54f060b6 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Fri, 24 Jul 1998 21:44:14 +0000 Subject: [PATCH] Fri Jul 24 14:41:19 1998 Michael Snyder * tracepoint.c (encode_actions): Treat register names and simple variable names as special cases and don't convert them to byte- codes: these things can be collected far more efficiently without invoking the bytecode interpreter. --- gdb/ChangeLog | 7 ++++ gdb/tracepoint.c | 88 ++++++++++++++++++++++++++++++------------------ 2 files changed, 62 insertions(+), 33 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f24f6ed027..d527b8046d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Fri Jul 24 14:41:19 1998 Michael Snyder + + * tracepoint.c (encode_actions): Treat register names and simple + variable names as special cases and don't convert them to byte- + codes: these things can be collected far more efficiently + without invoking the bytecode interpreter. + Fri Jul 24 13:32:46 1998 Mark Alexander * config/i386/tm-i386.h (STORE_STRUCT_RETURN): Make it diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 2d13d11a19..42898c482e 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1517,48 +1517,70 @@ encode_actions (t, tdp_actions, stepping_actions) struct agent_reqs areqs; exp = parse_exp_1 (&action_exp, block_for_pc (t->address), 1); - old_chain = make_cleanup (free_current_contents, &exp); - aexpr = gen_trace_for_expr (exp); + switch (exp->elts[0].opcode) { + case OP_REGISTER: + i = exp->elts[1].longconst; + if (info_verbose) + printf_filtered ("OP_REGISTER: "); + add_register (collect, i); + break; - old_chain1 = make_cleanup (free_agent_expr, aexpr); + case UNOP_MEMVAL: + /* safe because we know it's a simple expression */ + tempval = evaluate_expression (exp); + addr = VALUE_ADDRESS (tempval) + VALUE_OFFSET (tempval); + len = TYPE_LENGTH (check_typedef (exp->elts[1].type)); + add_memrange (collect, -1, addr, len); + break; - ax_reqs (aexpr, &areqs); - if (areqs.flaw != agent_flaw_none) - error ("malformed expression"); + case OP_VAR_VALUE: + collect_symbol (collect, exp->elts[2].symbol); + break; - if (areqs.min_height < 0) - error ("gdb: Internal error: expression has min height < 0"); - if (areqs.max_height > 20) - error ("expression too complicated, try simplifying"); + default: /* full-fledged expression */ + aexpr = gen_trace_for_expr (exp); - discard_cleanups (old_chain1); - add_aexpr (collect, aexpr); + old_chain1 = make_cleanup (free_agent_expr, aexpr); - /* take care of the registers */ - if (areqs.reg_mask_len > 0) - { - int ndx1; - int ndx2; + ax_reqs (aexpr, &areqs); + if (areqs.flaw != agent_flaw_none) + error ("malformed expression"); - for (ndx1 = 0; ndx1 < areqs.reg_mask_len; ndx1++) - { - QUIT; /* allow user to bail out with ^C */ - if (areqs.reg_mask[ndx1] != 0) - { - /* assume chars have 8 bits */ - for (ndx2 = 0; ndx2 < 8; ndx2++) - if (areqs.reg_mask[ndx1] & (1 << ndx2)) - /* it's used -- record it */ - add_register (collect, ndx1 * 8 + ndx2); - } - } - } + if (areqs.min_height < 0) + error ("gdb: Internal error: expression has min height < 0"); + if (areqs.max_height > 20) + error ("expression too complicated, try simplifying"); + + discard_cleanups (old_chain1); + add_aexpr (collect, aexpr); + + /* take care of the registers */ + if (areqs.reg_mask_len > 0) + { + int ndx1; + int ndx2; + + for (ndx1 = 0; ndx1 < areqs.reg_mask_len; ndx1++) + { + QUIT; /* allow user to bail out with ^C */ + if (areqs.reg_mask[ndx1] != 0) + { + /* assume chars have 8 bits */ + for (ndx2 = 0; ndx2 < 8; ndx2++) + if (areqs.reg_mask[ndx1] & (1 << ndx2)) + /* it's used -- record it */ + add_register (collect, ndx1 * 8 + ndx2); + } + } + } + break; + } /* switch */ do_cleanups (old_chain); - } + } /* do */ } while (action_exp && *action_exp++ == ','); - } + } /* if */ else if (cmd->function.cfunc == while_stepping_pseudocommand) { collect = &stepping_list; @@ -1570,7 +1592,7 @@ encode_actions (t, tdp_actions, stepping_actions) else break; /* end tracepoint actions */ } - } + } /* for */ memrange_sortmerge (&tracepoint_list); memrange_sortmerge (&stepping_list);