Skip to content

Commit

Permalink
Fix: stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
dnzbk committed Dec 12, 2024
1 parent 8e9bb2f commit 98e6264
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "riscv32|rv32")
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEBUG 1)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang")
add_compile_options(-Weverything -Wno-c++98-compat)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down
3 changes: 3 additions & 0 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Define to 1 to include debug-code */
#cmakedefine DEBUG

/* Name of package */
#cmakedefine PACKAGE "@PACKAGE@"

Expand Down
4 changes: 4 additions & 0 deletions cmake/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ find_package(Threads REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(Boost REQUIRED COMPONENTS json)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(LIBS ${LIBS} dbghelp.lib)
endif()

set(LIBS ${LIBS} Threads::Threads Boost::json LibXml2::LibXml2 winmm.lib)
set(INCLUDES ${INCLUDES} ${Boost_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})

Expand Down
4 changes: 2 additions & 2 deletions daemon/main/StackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void PrintBacktrace(PCONTEXT context)
srcFileName = "<filename not available>";
}

info("%s (%i) : %s", *srcFileName, lineNumber, *symName);
error("Stacktrace: %s (%i) : %s", *srcFileName, lineNumber, *symName);

if (sfStackFrame.AddrReturn.Offset == 0)
{
Expand Down Expand Up @@ -209,7 +209,7 @@ void PrintBacktrace()
error("Obtained %zd stack frames", size);
for (i = 0; i < size; i++)
{
error("%s", strings[i]);
error("Stacktrace: %s", strings[i]);
}

free(strings);
Expand Down
2 changes: 1 addition & 1 deletion lib/regex/regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ re_string_reconstruct(re_string_t* pstr, int idx, int eflags)
pstr->valid_len - offset);
pstr->valid_len -= offset;
pstr->valid_raw_len -= offset;
#if DEBUG
#ifdef DEBUG
assert(pstr->valid_len > 0);
#endif
}
Expand Down

0 comments on commit 98e6264

Please sign in to comment.