[PATCH 1/9] unwind: make the field type of struct tcb libunwind independent
Dmitry V. Levin
ldv at altlinux.org
Wed Mar 14 23:51:45 UTC 2018
On Wed, Mar 14, 2018 at 02:28:06AM +0900, Masatake YAMATO wrote:
> Narrwoing the area where the code refers names abot libunwind is needed
s/Narrwoing/Narrowing/
s/refers names/refers to names/
s/abot/associated with/
> to utilize libdw of elfutils as replaceable alternative unwinder.
s/replaceable alternative/an alternative/
>
> * defs.h (struct tcb): Rename a field, "libunwind_ui" to "unwind_ctx".
Rename libunwind_ui field to unwind_ctx, change its type to "void *".
> * unwind.c (unwind_tcb_init): Reflect the above field renaming.
> (unwind_tcb_fin)> Ditto.
s/)>/):/
> (stracetrace_walk): Ditto.
>
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
> ---
> defs.h | 2 +-
> unwind.c | 13 +++++++------
> 2 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/defs.h b/defs.h
> index 34261e4b..4d78e0d0 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -223,7 +223,7 @@ struct tcb {
> unsigned int mmap_cache_generation;
>
> #ifdef USE_LIBUNWIND
> - struct UPT_info *libunwind_ui;
> + void *unwind_ctx;
> struct queue_t *queue;
> #endif
> };
> diff --git a/unwind.c b/unwind.c
> index a272fba8..1b06aa3d 100644
> --- a/unwind.c
> +++ b/unwind.c
> @@ -81,11 +81,11 @@ unwind_init(void)
> void
> unwind_tcb_init(struct tcb *tcp)
> {
> - if (tcp->libunwind_ui)
> + if (tcp->unwind_ctx)
> return;
>
> - tcp->libunwind_ui = _UPT_create(tcp->pid);
> - if (!tcp->libunwind_ui)
> + tcp->unwind_ctx = _UPT_create(tcp->pid);
> + if (!tcp->unwind_ctx)
> perror_msg_and_die("_UPT_create");
>
> tcp->queue = xmalloc(sizeof(*tcp->queue));
> @@ -100,8 +100,8 @@ unwind_tcb_fin(struct tcb *tcp)
> free(tcp->queue);
> tcp->queue = NULL;
>
> - _UPT_destroy(tcp->libunwind_ui);
> - tcp->libunwind_ui = NULL;
> + _UPT_destroy((struct UPT_info *)tcp->unwind_ctx);
No need to cast "void *" to "struct UPT_info *".
> + tcp->unwind_ctx = NULL;
> }
>
> static void
> @@ -200,7 +200,8 @@ stacktrace_walk(struct tcb *tcp,
>
> symbol_name = xmalloc(symbol_name_size);
>
> - if (unw_init_remote(&cursor, libunwind_as, tcp->libunwind_ui) < 0)
> + if (unw_init_remote(&cursor, libunwind_as,
> + (struct UPT_info *)tcp->unwind_ctx) < 0)
Likewise.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180315/cbdf4c7b/attachment.bin>
More information about the Strace-devel
mailing list