Re: [patch v6 03/21] btrace: change branch trace data structure

Jan Kratochvil
2013-10-06T19:46:43Z

On Fri, 20 Sep 2013 13:30:21 +0200, Markus Metzger wrote:
> --- a/gdb/btrace.h
> +++ b/gdb/btrace.h
[...]
> @@ -103,16 +168,25 @@ struct btrace_thread_info
> the underlying architecture. */
> struct btrace_target_info *target;
>
> - /* The current branch trace for this thread. */
> - VEC (btrace_block_s) *btrace;
> - VEC (btrace_inst_s) *itrace;
> - VEC (btrace_func_s) *ftrace;
> + /* The current branch trace for this thread (both inclusive).
> +
> + The last instruction of END is the current instruction, which is not
> + part of the execution history.
> + Both will be NULL if there is not branch trace available. If there is

I do not think the wording is right. Either:
Both will be NULL if branch trace is not available.
or
Both will be NULL if there is no branch trace available.

> + branch trace available, both will be non-NULL. */
> + struct btrace_function *begin;
> + struct btrace_function *end;
> +
> + /* The function level offset. When added to each function's LEVEL,
> + this normalizes the function levels such that the smallest level
> + becomes zero. */
> + int level;
>
[...]
> +/* Initialize a branch trace call iterator to point to the begin/end of
> + the branch trace. Throws an error if there is no branch trace. */
> +extern void btrace_call_begin (struct btrace_call_iterator *,
> + const struct btrace_thread_info *);
> +extern void btrace_call_end (struct btrace_call_iterator *,
> + const struct btrace_thread_info *);
> +
> +/* Increment/decrement a branch trace call iterator by at most STRIDE function
> + segments. Return the number of function segments s by which the call

Typo, excessive " s ".

> + iterator has been advanced.
> + Returns zero, if the operation failed or STRIDE had been zero. */
> +extern unsigned int btrace_call_next (struct btrace_call_iterator *,
> + unsigned int stride);
> +extern unsigned int btrace_call_prev (struct btrace_call_iterator *,
> + unsigned int stride);

Thanks,
Jan