What about merge function gen_trace_for_expr and function gen_eval_for_expr together?
Stan Shebs
stanshebs@earthlink.net
Tue Jun 12 01:49:00 GMT 2012
On 6/11/12 5:15 PM, Hui Zhu wrote:
> Hi guys,
>
> When I read the code, I found that most part of these functions are same:
> 2c2
> < gen_trace_for_expr (CORE_ADDR scope, struct expression *expr)
> ---
>> gen_eval_for_expr (CORE_ADDR scope, struct expression *expr)
> 12c12
> < trace_kludge = 1;
> ---
>> trace_kludge = 0;
> 16,17c16
> < /* Make sure we record the final object, and get rid of it. */
> < gen_traced_pop (expr->gdbarch, ax, &value);
> ---
>> require_rvalue (ax, &value);
>
>
> What about add a new argument for example trace or eval and merge them
> together?
I certainly considered that when introducing gen_eval_for_expr, but it
seemed like repeatedly testing a flag for the parts that are different
was going to make it more complicated than having the two separate
functions. I also expected that they might need to diverge a bit more
over time, for instance if trace_kludge were to be gotten rid of (as it
should be).
Stan
stan@codesourcery.com
More information about the Gdb
mailing list