Enable existing MSVC stack backtrace code on MinGW where supported.
The existing code seems to work fine, though symbol lookup in openttd.exe does not work.
This commit is contained in:
21
config.lib
21
config.lib
@@ -1612,6 +1612,27 @@ EOL
|
||||
rm tmp.config.bfd
|
||||
fi
|
||||
|
||||
if [ "$os" = "MINGW" ]; then
|
||||
"$cc_host" $CFLAGS $LDFLAGS -o tmp.config.dbghelp -x c++ - 2> /dev/null << EOL
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
int main() {
|
||||
STACKFRAME64 frame;
|
||||
IMAGEHLP_SYMBOL64 *sym_info;
|
||||
IMAGEHLP_MODULE64 module;
|
||||
IMAGEHLP_LINE64 line;
|
||||
return 0;
|
||||
}
|
||||
EOL
|
||||
if [ $? -ne 0 ]; then
|
||||
log 1 "checking dbghelp... no"
|
||||
else
|
||||
log 1 "checking dbghelp... found"
|
||||
CFLAGS="$CFLAGS -DWITH_DBGHELP"
|
||||
fi
|
||||
rm -f tmp.config.dbghelp
|
||||
fi
|
||||
|
||||
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
|
||||
LIBS="$LIBS -lc"
|
||||
fi
|
||||
|
||||
@@ -49,12 +49,13 @@ class CrashLogWindows : public CrashLog {
|
||||
/* virtual */ char *LogRegisters(char *buffer, const char *last) const;
|
||||
/* virtual */ char *LogModules(char *buffer, const char *last) const;
|
||||
public:
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(WITH_DBGHELP)
|
||||
/* virtual */ int WriteCrashDump(char *filename, const char *filename_last) const;
|
||||
char *AppendDecodedStacktrace(char *buffer, const char *last) const;
|
||||
#else
|
||||
char *AppendDecodedStacktrace(char *buffer, const char *last) const { return buffer; }
|
||||
#endif /* _MSC_VER */
|
||||
#endif /* _MSC_VER || WITH_DBGHELP */
|
||||
|
||||
|
||||
/** Buffer for the generated crash log */
|
||||
char crashlog[65536];
|
||||
@@ -321,10 +322,14 @@ static char *PrintModuleInfo(char *output, const char *last, HMODULE mod)
|
||||
return buffer + seprintf(buffer, last, "\n");
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) || defined(WITH_DBGHELP)
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable:4091)
|
||||
#endif
|
||||
#include <dbghelp.h>
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default:4091)
|
||||
#endif
|
||||
|
||||
char *CrashLogWindows::AppendDecodedStacktrace(char *buffer, const char *last) const
|
||||
{
|
||||
@@ -479,7 +484,7 @@ char *CrashLogWindows::AppendDecodedStacktrace(char *buffer, const char *last) c
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
#endif /* _MSC_VER || WITH_DBGHELP */
|
||||
|
||||
extern bool CloseConsoleLogIfActive();
|
||||
static void ShowCrashlogWindow();
|
||||
|
||||
Reference in New Issue
Block a user