Re: [PATCH v5 4/5] perf callchain: Support x86 target platform

From: Jiri Olsa
Date: Thu May 26 2016 - 13:58:01 EST


On Tue, May 24, 2016 at 09:20:28AM +0000, He Kuang wrote:
> Support x86(32-bit) cross platform callchain unwind.
>
> Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
> ---
> .../perf/arch/x86/include/libunwind/libunwind-arch.h | 18 ++++++++++++++++++
> tools/perf/arch/x86/util/unwind-libunwind.c | 19 ++++++++++++++-----
> tools/perf/util/Build | 6 ++++++
> tools/perf/util/unwind-libunwind_common.c | 6 ++++--
> tools/perf/util/unwind.h | 5 +++++
> 5 files changed, 47 insertions(+), 7 deletions(-)
> create mode 100644 tools/perf/arch/x86/include/libunwind/libunwind-arch.h
>
> diff --git a/tools/perf/arch/x86/include/libunwind/libunwind-arch.h b/tools/perf/arch/x86/include/libunwind/libunwind-arch.h
> new file mode 100644
> index 0000000..be8c675
> --- /dev/null
> +++ b/tools/perf/arch/x86/include/libunwind/libunwind-arch.h
> @@ -0,0 +1,18 @@
> +#ifndef _LIBUNWIND_ARCH_H
> +#define _LIBUNWIND_ARCH_H
> +
> +#include <libunwind-x86.h>
> +#include <../perf_regs.h>
> +#include <../../../../../../arch/x86/include/uapi/asm/perf_regs.h>
> +
> +#define LIBUNWIND_X86_32
> +int libunwind__x86_reg_id(int regnum);
> +
> +#define LIBUNWIND__ARCH_REG_ID libunwind__x86_reg_id
> +
> +#include <../../../x86/util/unwind-libunwind.c>
> +
> +#define UNWT_PREFIX UNW_PASTE(UNW_PASTE(_U, x86), _)
> +#define UNWT_OBJ(fn) UNW_PASTE(UNWT_PREFIX, fn)

is there a reason for using libunwind define for the symbol prefix?
what's the '_U' and all those '__' for? why dont we use simple macro
for arch prefix?

this explanation would be great to have in those wrapper obects
I meantioned in earlier email:
util/unwind-libunwind-local.c
util/unwind-libunwind-x86_32.c
util/unwind-libunwind-arm64.c


thanks,
jirka