diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c14c51fe..780dad855 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -434,7 +434,6 @@ if(BKPAD_MINIDUMP) ${PROCESSOR_SRC_DIR}/call_stack.cc ${PROCESSOR_SRC_DIR}/cfi_frame_info.cc ${PROCESSOR_SRC_DIR}/convert_old_arm64_context.cc - ${PROCESSOR_SRC_DIR}/disassembler_objdump.cc ${PROCESSOR_SRC_DIR}/disassembler_x86.cc ${PROCESSOR_SRC_DIR}/dump_context.cc ${PROCESSOR_SRC_DIR}/dump_object.cc @@ -468,7 +467,6 @@ if(BKPAD_MINIDUMP) set(PROCESSOR_COMMON_HEADERS ${PROCESSOR_SRC_DIR}/basic_code_modules.h ${PROCESSOR_SRC_DIR}/cfi_frame_info.h - ${PROCESSOR_SRC_DIR}/disassembler_objdump.h ${PROCESSOR_SRC_DIR}/disassembler_x86.h ${PROCESSOR_SRC_DIR}/exploitability_win.h ${PROCESSOR_SRC_DIR}/exploitability_linux.h @@ -488,6 +486,13 @@ if(BKPAD_MINIDUMP) ${PROCESSOR_SRC_DIR}/stackwalker_x86.h ${PROCESSOR_SRC_DIR}/tokenize.h) + if(UNIX) + list(APPEND PROCESSOR_COMMON_SRCS + ${PROCESSOR_SRC_DIR}/disassembler_objdump.cc) + list(APPEND PROCESSOR_COMMON_HEADERS + ${PROCESSOR_SRC_DIR}/disassembler_objdump.h) + endif() + add_library(processor_common STATIC ${PROCESSOR_COMMON_SRCS} ${PROCESSOR_COMMON_HEADERS}) breakpad_set_project_properties(processor_common) diff --git a/src/third_party/windows/libgen.c b/src/third_party/windows/libgen.c index 4f95b75ec..142f33b6d 100644 --- a/src/third_party/windows/libgen.c +++ b/src/third_party/windows/libgen.c @@ -2,7 +2,7 @@ #include char *basename(char *path) { - static char fname[_MAX_FNAME]; + static char fname[_MAX_FNAME] = {0}; strncpy_s(fname, sizeof(fname), path, strlen(path)); fname[sizeof(fname) - 1] = 0; @@ -13,7 +13,7 @@ char *basename(char *path) { } char *dirname(char *path) { - static char dname[_MAX_DIR]; + static char dname[_MAX_DIR] = {0}; strncpy_s(dname, sizeof(dname), path, strlen(path)); dname[sizeof(dname) - 1] = 0; diff --git a/src/third_party/windows/libgen.h b/src/third_party/windows/libgen.h index e69de29bb..c5b230883 100644 --- a/src/third_party/windows/libgen.h +++ b/src/third_party/windows/libgen.h @@ -0,0 +1,12 @@ +#define strdup _strdup + +#ifdef __cplusplus +extern "C" { +#endif + +char *basename(char *path); +char *dirname(char *path); + +#ifdef __cplusplus +} +#endif