[PATCH] Handle LOC_COMPUTED variables in tracepoint actions

Stan Shebs stan@codesourcery.com
Fri Dec 18 19:46:00 GMT 2009

The last time that anybody used tracepoints much, stabs was still the 
norm and Dwarf 2 the newbie, and so nobody thought much about handling 
variables with computed locations.  Nowadays many local variables have 
computed locations, and we have to generate appropriate agent expression 
bytecodes.  Worse, the top-level encoding machinery for tracepoint 
actions will issue instructions to collect variables directly, not using 
bytecodes, so we need to detect when bytecodes are necessary.  (In 
theory we could always generate bytecodes for collection expressions; 
that would make a good cleanup for later.)

This patch doesn't handle every possible computed location, that's a big 
project of its own (basically translating arbitrary dwarf2 bytecode 
sequences into equivalent agent expression bytecodes), it just handles 
frame/base register combinations that are typical for local vars.  Even 
the simplified version is a little arcane, so I'll leave it up for 
comments for a few days before committing.


2009-12-18  Stan Shebs  <stan@codesourcery.com>

    * ax-gdb.h (gen_trace_for_var): Declare.
    * ax-gdb.c (gen_trace_for_var): New function.
    * dwarf2loc.c (dwarf_expr_frame_base_1): New function, split from...
    (dwarf_expr_frame_base): ...here.
    (dwarf2_tracepoint_var_ref): Add computed location case.
    * tracepoint.c (collect_symbol): Add scope arg and LOC_COMPUTED
    (add_local_symbols): Update call to collect_symbol.
    (encode_actions): Ditto.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: loccomp-patch-1
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20091218/c5826d91/attachment.ksh>

More information about the Gdb-patches mailing list