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: tracepoints: Use constant-size trace opcodes where possible


On Fri, 2007-10-26 at 16:10 -0700, Jim Blandy wrote:
> The comments should explain what's going on here.  The Linux
> tracepoint agent was much simplified by restricting it to expressions
> whose data size could be estimated in advance.  This should have no
> effect on other agents.
> 
> Okay to commit?

Looks fine.

> 
> gdb/ChangeLog:
> 2007-10-25  Jim Blandy  <jimb@codesourcery.com>
> 
> 	* ax-gdb.c (gen_traced_pop): Generate trace_quick or trace16
> 	bytecodes whenever possible.
> 
> diff -r cdc626576c72 -r 84b7570f26f4 gdb/ax-gdb.c
> --- a/gdb/ax-gdb.c	Thu Oct 25 12:43:14 2007 -0700
> +++ b/gdb/ax-gdb.c	Thu Oct 25 12:47:24 2007 -0700
> @@ -321,13 +321,22 @@ gen_traced_pop (struct agent_expr *ax, s
>  	{
>  	  int length = TYPE_LENGTH (check_typedef (value->type));
>  
> -	  /* There's no point in trying to use a trace_quick bytecode
> -	     here, since "trace_quick SIZE pop" is three bytes, whereas
> -	     "const8 SIZE trace" is also three bytes, does the same
> -	     thing, and the simplest code which generates that will also
> -	     work correctly for objects with large sizes.  */
> -	  ax_const_l (ax, length);
> -	  ax_simple (ax, aop_trace);
> +          /* Try to generate a trace_quick here if we can.  The
> +             bytecode stream generated isn't any shorter ('quick <len>
> +             pop' and 'const8 <len> trace' are both three bytes long),
> +             but this simplifies agent expression evaluators that want
> +             to be able to easily put an upper bound on the memory
> +             that will be collected by an expression.  */
> +          if (length < 1 << 16)
> +            {
> +              ax_trace_quick (ax, length);
> +              ax_simple (ax, aop_pop);
> +            }
> +          else
> +            {
> +              ax_const_l (ax, length);
> +              ax_simple (ax, aop_trace);
> +            }
>  	}
>  	break;
>  


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