add NYX_DEBUG option in debug mode
This commit is contained in:
parent
d407bab254
commit
ab668227f9
@ -28,11 +28,11 @@ error()
|
|||||||
echo "$0: <option>"
|
echo "$0: <option>"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Available compile options: "
|
echo "Available compile options: "
|
||||||
echo " - dynamic dynamically link libxdc and capstone4"
|
echo " - dynamic dynamically link libxdc and capstone4"
|
||||||
echo " - static statically 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 " - lto enable static linking and LTO (up to 10% better performance)"
|
||||||
echo " - debug enable several debug options"
|
echo " - debug enable debug and ASAN options"
|
||||||
echo " - debug_static enable several debug options and statically link libxdc and capstone4"
|
echo " - debug_static enable debug, ASAN and static linking"
|
||||||
echo ""
|
echo ""
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ compile_libraries()
|
|||||||
|
|
||||||
configure_qemu()
|
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
|
case $1 in
|
||||||
"debug_static"|"static"|"lto")
|
"debug_static"|"static"|"lto")
|
||||||
@ -68,10 +68,10 @@ configure_qemu()
|
|||||||
$QEMU_CONFIGURE --enable-nyx
|
$QEMU_CONFIGURE --enable-nyx
|
||||||
;;
|
;;
|
||||||
"debug")
|
"debug")
|
||||||
$QEMU_CONFIGURE --enable-nyx --enable-sanitizers --enable-debug
|
$QEMU_CONFIGURE --enable-nyx --enable-sanitizers --enable-debug --enable-nyx-debug
|
||||||
;;
|
;;
|
||||||
"debug_static")
|
"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")
|
"static")
|
||||||
$QEMU_CONFIGURE --enable-nyx --enable-nyx-static
|
$QEMU_CONFIGURE --enable-nyx --enable-nyx-static
|
||||||
|
6
configure
vendored
6
configure
vendored
@ -955,6 +955,8 @@ for opt do
|
|||||||
;;
|
;;
|
||||||
--enable-nyx-flto) nyx_flto="yes"
|
--enable-nyx-flto) nyx_flto="yes"
|
||||||
;;
|
;;
|
||||||
|
--enable-nyx-debug) nyx_debug="yes"
|
||||||
|
;;
|
||||||
--version|-V) exec cat $source_path/VERSION
|
--version|-V) exec cat $source_path/VERSION
|
||||||
;;
|
;;
|
||||||
--prefix=*) prefix="$optarg"
|
--prefix=*) prefix="$optarg"
|
||||||
@ -6104,6 +6106,10 @@ write_c_skeleton
|
|||||||
if test "$nyx" = "yes" ; then
|
if test "$nyx" = "yes" ; then
|
||||||
CFLAGS="-DNESTED_PATCH -Wno-error=maybe-uninitialized -DQEMU_NYX -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
|
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
|
if test "$nyx_static" = "yes" ; then
|
||||||
LIBS="-l:libcapstone.a -l:libxdc.a $LIBS"
|
LIBS="-l:libcapstone.a -l:libxdc.a $LIBS"
|
||||||
else
|
else
|
||||||
|
17
nyx/debug.h
17
nyx/debug.h
@ -26,18 +26,19 @@
|
|||||||
#define ENDC "\033[0m"
|
#define ENDC "\033[0m"
|
||||||
|
|
||||||
|
|
||||||
//#define debug_printf(format, ...) printf (format, ##__VA_ARGS__)
|
#ifdef NYX_DEBUG
|
||||||
//#define debug_fprintf(fd, format, ...) fprintf (fd, format, ##__VA_ARGS__)
|
#define debug_printf(format, ...) printf (format, ##__VA_ARGS__)
|
||||||
//#define QEMU_PT_PRINTF(PREFIX, format, ...) printf (QEMU_PT_PRINT_PREFIX COLOR PREFIX format ENDC "\n", ##__VA_ARGS__)
|
#define debug_fprintf(fd, format, ...) fprintf (fd, format, ##__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(PREFIX, format, ...) printf (QEMU_PT_PRINT_PREFIX COLOR PREFIX format ENDC "\n", ##__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__)
|
#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_printf(format, ...)
|
||||||
#define debug_fprintf(fd, format, ...)
|
#define debug_fprintf(fd, format, ...)
|
||||||
#define QEMU_PT_PRINTF(PREFIX, format, ...)
|
#define QEMU_PT_PRINTF(PREFIX, format, ...)
|
||||||
#define QEMU_PT_PRINTF_DBG(PREFIX, format, ...)
|
#define QEMU_PT_PRINTF_DBG(PREFIX, format, ...)
|
||||||
#define QEMU_PT_PRINTF_DEBUG(format, ...)
|
#define QEMU_PT_PRINTF_DEBUG(format, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_BACKTRACES
|
#ifdef ENABLE_BACKTRACES
|
||||||
@ -46,4 +47,4 @@ void qemu_backtrace(void);
|
|||||||
void init_crash_handler(void);
|
void init_crash_handler(void);
|
||||||
void hexdump_kafl(const void* data, size_t size);
|
void hexdump_kafl(const void* data, size_t size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -170,4 +170,4 @@ uint64_t sharedir_request_file(sharedir_t* self, const char* file, uint8_t* page
|
|||||||
fprintf(stderr, "WARNING: No such file in sharedir: %s\n", file);
|
fprintf(stderr, "WARNING: No such file in sharedir: %s\n", file);
|
||||||
return 0xFFFFFFFFFFFFFFFFUL;
|
return 0xFFFFFFFFFFFFFFFFUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user