add NYX_DEBUG option in debug mode

This commit is contained in:
Steffen Schulz 2022-05-22 21:42:43 +02:00 committed by Sergej Schumilo
parent d407bab254
commit ab668227f9
4 changed files with 24 additions and 17 deletions

View File

@ -30,9 +30,9 @@ error()
echo "Available compile options: "
echo " - dynamic dynamically link libxdc and capstone4"
echo " - static statically link libxdc and capstone4"
echo " - lto statically link libxdc and capstone4 and enable LTO (up to 10% better performance)"
echo " - debug enable several debug options"
echo " - debug_static enable several debug options and statically link libxdc and capstone4"
echo " - lto enable static linking and LTO (up to 10% better performance)"
echo " - debug enable debug and ASAN options"
echo " - debug_static enable debug, ASAN and static linking"
echo ""
exit 1
}
@ -52,7 +52,7 @@ compile_libraries()
configure_qemu()
{
QEMU_CONFIGURE="./configure --target-list=x86_64-softmmu --disable-gtk --disable-docs --enable-gtk --disable-werror --disable-capstone --disable-libssh --disable-tools"
QEMU_CONFIGURE="./configure --target-list=x86_64-softmmu --disable-docs --disable-gtk --disable-werror --disable-capstone --disable-libssh --disable-tools"
case $1 in
"debug_static"|"static"|"lto")
@ -68,10 +68,10 @@ configure_qemu()
$QEMU_CONFIGURE --enable-nyx
;;
"debug")
$QEMU_CONFIGURE --enable-nyx --enable-sanitizers --enable-debug
$QEMU_CONFIGURE --enable-nyx --enable-sanitizers --enable-debug --enable-nyx-debug
;;
"debug_static")
$QEMU_CONFIGURE --enable-nyx --enable-sanitizers --enable-debug --enable-nyx-static
$QEMU_CONFIGURE --enable-nyx --enable-sanitizers --enable-debug --enable-nyx-debug --enable-nyx-static
;;
"static")
$QEMU_CONFIGURE --enable-nyx --enable-nyx-static

6
configure vendored
View File

@ -955,6 +955,8 @@ for opt do
;;
--enable-nyx-flto) nyx_flto="yes"
;;
--enable-nyx-debug) nyx_debug="yes"
;;
--version|-V) exec cat $source_path/VERSION
;;
--prefix=*) prefix="$optarg"
@ -6104,6 +6106,10 @@ write_c_skeleton
if test "$nyx" = "yes" ; then
CFLAGS="-DNESTED_PATCH -Wno-error=maybe-uninitialized -DQEMU_NYX -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
if test "$nyx_debug" = "yes"; then
CFLAGS="-DNYX_DEBUG $CFLAGS"
fi
if test "$nyx_static" = "yes" ; then
LIBS="-l:libcapstone.a -l:libxdc.a $LIBS"
else

View File

@ -26,18 +26,19 @@
#define ENDC "\033[0m"
//#define debug_printf(format, ...) printf (format, ##__VA_ARGS__)
//#define debug_fprintf(fd, format, ...) fprintf (fd, format, ##__VA_ARGS__)
//#define QEMU_PT_PRINTF(PREFIX, format, ...) printf (QEMU_PT_PRINT_PREFIX COLOR PREFIX format ENDC "\n", ##__VA_ARGS__)
//#define QEMU_PT_PRINTF_DBG(PREFIX, format, ...) printf (QEMU_PT_PRINT_PREFIX PREFIX "(%s#:%d)\t"format, __BASE_FILE__, __LINE__, ##__VA_ARGS__)
//#define QEMU_PT_PRINTF_DEBUG(format, ...) fprintf (stderr, QEMU_PT_PRINT_PREFIX DEBUG_VM_PREFIX "(%s#:%d)\t"format "\n", __BASE_FILE__, __LINE__, ##__VA_ARGS__)
#ifdef NYX_DEBUG
#define debug_printf(format, ...) printf (format, ##__VA_ARGS__)
#define debug_fprintf(fd, format, ...) fprintf (fd, format, ##__VA_ARGS__)
#define QEMU_PT_PRINTF(PREFIX, format, ...) printf (QEMU_PT_PRINT_PREFIX COLOR PREFIX format ENDC "\n", ##__VA_ARGS__)
#define QEMU_PT_PRINTF_DBG(PREFIX, format, ...) printf (QEMU_PT_PRINT_PREFIX PREFIX "(%s#:%d)\t"format, __BASE_FILE__, __LINE__, ##__VA_ARGS__)
#define QEMU_PT_PRINTF_DEBUG(format, ...) fprintf (stderr, QEMU_PT_PRINT_PREFIX DEBUG_VM_PREFIX "(%s#:%d)\t"format "\n", __BASE_FILE__, __LINE__, ##__VA_ARGS__)
#else
#define debug_printf(format, ...)
#define debug_fprintf(fd, format, ...)
#define QEMU_PT_PRINTF(PREFIX, format, ...)
#define QEMU_PT_PRINTF_DBG(PREFIX, format, ...)
#define QEMU_PT_PRINTF_DEBUG(format, ...)
#endif
#ifdef ENABLE_BACKTRACES