public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* What about merge function gen_trace_for_expr and function gen_eval_for_expr together?
@ 2012-06-12  0:16 Hui Zhu
  2012-06-12  1:49 ` Stan Shebs
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Zhu @ 2012-06-12  0:16 UTC (permalink / raw)
  To: gdb

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?

Thanks,
Hui

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: What about merge function gen_trace_for_expr and function gen_eval_for_expr together?
  2012-06-12  0:16 What about merge function gen_trace_for_expr and function gen_eval_for_expr together? Hui Zhu
@ 2012-06-12  1:49 ` Stan Shebs
  0 siblings, 0 replies; 2+ messages in thread
From: Stan Shebs @ 2012-06-12  1:49 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-12  1:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-12  0:16 What about merge function gen_trace_for_expr and function gen_eval_for_expr together? Hui Zhu
2012-06-12  1:49 ` Stan Shebs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).