[PATCH 01/25] ldv/unwind: improve stacktrace feature(v2)

Luca Clementi luca.clementi at gmail.com
Mon Nov 4 02:50:01 UTC 2013


On Sun, Nov 3, 2013 at 2:01 PM, Masatake YAMATO <yamato at redhat.com> wrote:
> Based on the discussion on strace-devel, I improved following points:
>
> * use unwind_ as prefix for functions exported from unwind.c
>

I really like this!

[...]

> +/*
> + * Keep a captured stracktrace.
> + */
> +struct call_t {
> +       struct call_t* next;
> +       char* binary_filename;
> +       char* symbol_name;
> +       unw_word_t function_off_set;
> +       unsigned long true_offset;
> +       const char* error;
> +};
> +
> +struct queue_t {
> +       struct call_t *tail;
> +       struct call_t *head;
> +};

Hey Masatake,
I am just wondering if it make sense to keep all those field in the
call_t struct?
Wouldn't a simple string buffer do the job?

For example something like:
struct call_t {
       struct call_t* next;
       char* output_line;
};

You insert one output line for each stack line.
And then when it's time to fire the output you can simply "fputs" for
each entry in the queue_t.
Would this make the whole patch simpler?
Please let me know if I am missing something.


Luca




More information about the Strace-devel mailing list