From 587ff7f6e45eba161c8cf1ff606fde2a3da24b4c Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Thu, 14 Dec 2017 16:29:33 +0000 Subject: [PATCH] utils: Add a debug category for the command-line tools Signed-off-by: Simon McVittie <smcv@collabora.com> --- utils/debug.h | 1 + utils/utils.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/debug.h b/utils/debug.h index 5d0d24bb7..2eed3df89 100644 --- a/utils/debug.h +++ b/utils/debug.h @@ -29,6 +29,7 @@ enum DEBUG_RELOCS = 0x1 << 6, DEBUG_ELF = 0x1 << 7, DEBUG_DLFUNC = 0x1 << 8, + DEBUG_TOOL = 0x1 << 9, DEBUG_ALL = 0xffff, }; diff --git a/utils/utils.c b/utils/utils.c index 38ec3fad6..a1ea7e616 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -266,6 +266,7 @@ void set_debug_flags (const char *control) if( strstr( control, "reloc" ) ) debug_flags |= DEBUG_RELOCS; if( strstr( control, "elf" ) ) debug_flags |= DEBUG_ELF; if( strstr( control, "dlfunc" ) ) debug_flags |= DEBUG_DLFUNC; + if( strstr( control, "tool" ) ) debug_flags |= DEBUG_TOOL; if( strstr( control, "all" ) ) debug_flags |= DEBUG_ALL; if( !debug_flags ) @@ -280,7 +281,8 @@ void set_debug_flags (const char *control) " wrappers: %c # function wrappers installed in the capsule" "\n" " reloc : %c # patching capsule symbols into external DSOs" "\n" " dlfunc : %c # special handling of dlopen/dlsym calls" "\n" - " elf : %c # detailed ELF introspection logging" "\n", + " elf : %c # detailed ELF introspection logging" "\n" + " tool : %c # command-line tools" "\n", (debug_flags & DEBUG_PATH ) ? 'Y' : 'n' , (debug_flags & DEBUG_SEARCH ) ? 'Y' : 'n' , (debug_flags & DEBUG_LDCACHE ) ? 'Y' : 'n' , @@ -289,7 +291,8 @@ void set_debug_flags (const char *control) (debug_flags & DEBUG_WRAPPERS) ? 'Y' : 'n' , (debug_flags & DEBUG_RELOCS ) ? 'Y' : 'n' , (debug_flags & DEBUG_DLFUNC ) ? 'Y' : 'n' , - (debug_flags & DEBUG_ELF ) ? 'Y' : 'n' ); + (debug_flags & DEBUG_ELF ) ? 'Y' : 'n' , + (debug_flags & DEBUG_TOOL ) ? 'Y' : 'n' ); } // soname: bare libfoo.so.X style name -- GitLab