This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: remove trace_kludge global


Hi, Tom,

On 03/12/2013 03:26 AM, Tom Tromey wrote:
@@ -2608,17 +2585,18 @@ agent_eval_command_one (char *exp, int eval, CORE_ADDR pc)
    struct cleanup *old_chain = 0;
    struct expression *expr;
    struct agent_expr *agent;
+  int trace_string = 0;

    if (!eval)
      {
-      trace_string_kludge = 0;
        if (*exp == '/')
-        exp = decode_agent_options (exp);
+        exp = decode_agent_options (exp, &trace_string);

'trace_string' is only set when 'eval' is zero, so...


}

    if (!eval && strcmp (exp, "$_ret") == 0)
      {
-      agent = gen_trace_for_return_address (pc, get_current_arch ());
+      agent = gen_trace_for_return_address (pc, get_current_arch (),
+					    trace_string);
        old_chain = make_cleanup_free_agent_expr (agent);
      }
    else
@@ -2626,9 +2604,9 @@ agent_eval_command_one (char *exp, int eval, CORE_ADDR pc)
        expr = parse_exp_1 (&exp, pc, block_for_pc (pc), 0);
        old_chain = make_cleanup (free_current_contents, &expr);
        if (eval)
-	agent = gen_eval_for_expr (pc, expr);
+	agent = gen_eval_for_expr (pc, expr, trace_string);

... 'trace_string' should be zero here. On the other hand, when 'eval' is true, we are evaluating the result of the expression, so no tracing stuff should be involved. So, we don't have to add the new argument 'trace_string' to gen_eval_for_expr, and set 'ax->trace_string' to zero inside gen_eval_for_expr, and the callers of gen_eval_for_expr are not updated.


        else
-	agent = gen_trace_for_expr (pc, expr);
+	agent = gen_trace_for_expr (pc, expr, trace_string);
        make_cleanup_free_agent_expr (agent);
      }
--
Yao (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]