[PATCH i-g-t v7 09/14] lib/igt_core: Implement conditional backtrace support using HAVE_LIBUNWIND

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri May 16 17:46:31 UTC 2025


Hi Jeevaka,
On 2025-05-16 at 17:11:48 +0000, Jeevaka Prabu Badrappan wrote:

imho subject could be improved,
[PATCH i-g-t v7 09/14] lib/igt_core: Implement conditional backtrace support using HAVE_LIBUNWIND

You didn't do any implementation here, only a 'dummy' one or a workaround.
so for example:
[PATCH i-g-t v7 09/14] lib/igt_core: Add a dummy workaround when libunwind is not present

> Add a log message indicating "backtrace not implemented" in the
> print_backtrace function and return when HAVE_LIBUNWIND is not defined.
> 
> Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>

This looks good
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

Regards,
Kamil

> ---
>  lib/igt_core.c | 4 ++++
>  meson.build    | 3 +++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 1d7402cb7..097a556c9 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -383,6 +383,9 @@ static int _igt_dynamic_tests_executed = -1;
>  
>  static void print_backtrace(void)
>  {
> +#ifndef HAVE_LIBUNWIND
> +	igt_info("backtrace not implemented\n");
> +#else
>  	unw_cursor_t cursor;
>  	unw_context_t uc;
>  	int stack_num = 0;
> @@ -440,6 +443,7 @@ static void print_backtrace(void)
>  
>  	if (dwfl)
>  		dwfl_end(dwfl);
> +#endif
>  }
>  
>  __attribute__((format(printf, 2, 3)))
> diff --git a/meson.build b/meson.build
> index 6a580bd7e..b88098234 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -147,6 +147,9 @@ else
>  endif
>  
>  libunwind = dependency('libunwind', required : get_option('libunwind'))
> +if libunwind.found()
> +	config.set('HAVE_LIBUNWIND', 1)
> +endif
>  build_info += 'With libunwind: @0@'.format(libunwind.found())
>  
>  libdw = dependency('libdw', required : true)
> -- 
> 2.49.0
> 


More information about the igt-dev mailing list