This is the mail archive of the 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: [PATCH] Collecting strings at tracepoints

On 10/4/11 12:10 PM, Tom Tromey wrote:
"Stan" == Stan Shebs<> writes:
Stan>  While conceptually simple, we need a new agent bytecode to make this
Stan>  work (writing a loop using existing bytecodes doesn't let us check
Stan>  that we're running off the edge of valid memory), and a support flag
Stan>  so that users get informed if the target doesn't support string
Stan>  collection.

Stan>  + /* Inspired by trace_kludge, this indicates that pointers to chars
Stan>  +    should get an added tracenz bytecode to record nonzero bytes, up to
Stan>  +    a length that is the value of string_kludge.  */
Stan>  + int string_kludge;

I'd prefer a name that makes it obvious that this is a tracing thing.

Stan>  +   { "tracenz", PACKET_DISABLE,
Stan>  +     remote_string_tracing_feature, -1 },

I think this requires documentation in the remote protocol section.

Stan>  +   while (*exp == ' ' || *exp == '\t')
Stan>  +     exp++;

We have skip_spaces now.

Thanks for the feedback! I took all into account, and committed this:

2011-11-02 Stan Shebs <>

    String collection for tracepoints.
    * NEWS: Mention string collection.
    * common/ax.def (tracenz): New bytecode.
    * ax-gdb.h (trace_string_kludge): Declare.
    * ax-gdb.c: Include valprint.h and c-lang.h.
    (trace_string_kludge): New global.
    (gen_traced_pop): Add string case.
    (agent_command): Add string case.
    * tracepoint.h (decode_agent_options): Declare.
    * tracepoint.c: Include cli-utils.h.
    (decode_agent_options): New function.
    (validate_actionline): Call it.
    (encode_actions_1): Ditto.
    * target.h (struct target_ops): New method to_supports_string_tracing.
    (target_supports_string_tracing): New macro.
    * target.c (update_current_target): Add to_supports_string_tracing.
    * remote.c (struct remote_state): New field string_tracing.
    (remote_string_tracing_feature): New function.
    (remote_protocol_features): New feature tracenz.
    (remote_supports_string_tracing): New function.
    (init_remote_ops): Set to_supports_string_tracing.

    * tracepoint.c (agent_mem_read_string): New function.
    (eval_agent_expr): Call it for tracenz.
    * server.c (handle_query): Report support for tracenz.

    * gdb.texinfo (Tracepoint Action Lists): Document collect/s.
    (General Query Packets): Describe tracenz feature.
    * agentexpr.texi (Bytecode Descriptions): Describe tracenz.

    * gdb.trace/collection.c: Add code using strings.
    * gdb.trace/collection.exp: Add tests of string collection.

Attachment: tstr-patch-2
Description: Text document

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