[PATCH] More C++ static fields for tracepoints

Stan Shebs stan@codesourcery.com
Wed Mar 17 22:17:00 GMT 2010


This patch solves a couple intertwined problems relating to tracepoint 
collection of C++ classes with static fields.  First, it adds 
recognition of variables (including static fields) whose location 
expressions indicate that they have been optimized out.  Second, to 
collect an instance of a class with static fields, we need to issue more 
bytecodes, since static fields are stored at their own addresses, 
separately from the instance.  The two are intertwined because when 
collecting the instance, we want to silently pass over any optimized-out 
static fields instead of error()ing out. (And believe it or not, all 
this was motivated by tracepoints choking on actual user code...)

Stan

2010-03-17 Stan Shebs  <stan@codesourcery.com>

    * ax-gdb.h (struct axs_value): New field optimized_out.
    (gen_trace_for_var): Add gdbarch argument.
    * ax-gdb.c (gen_trace_static_fields): New function.
    (gen_traced_pop): Call it, add gdbarch argument.
    (gen_trace_for_expr): Update call to it.
    (gen_trace_for_var): Ditto, and report optimized-out variables.
    (gen_struct_ref_recursive): Check for optimized-out value.
    (gen_struct_elt_for_reference): Ditto.
    (gen_static_field): Pass gdbarch instead of expression, assume
    optimization if field not found.
    (gen_var_ref): Set the optimized_out flag.
    (gen_expr): Error on optimized-out variable.
    * tracepoint.c (collect_symbol): Handle struct-valued vars as
    expressions, skip optimized-out variables with computed locations.
    * dwarf2loc.c (dwarf2_tracepoint_var_ref): Flag instead of
    erroring out if location expression missing.
    (loclist_tracepoint_var_ref): Don't error out here.



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


More information about the Gdb-patches mailing list