projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Event backend porting
[quassel.git]
/
src
/
common
/
logbacktrace_win.cpp
diff --git
a/src/common/logbacktrace_win.cpp
b/src/common/logbacktrace_win.cpp
index
5c9a420
..
b12c15d
100644
(file)
--- a/
src/common/logbacktrace_win.cpp
+++ b/
src/common/logbacktrace_win.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-0
8 by the Quassel IRC Team
*
+ * Copyright (C) 2005-0
9 by the Quassel Project
*
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-49,7
+49,7
@@
struct EnumModulesContext {
EnumModulesContext(HANDLE hProcess, QTextStream &stream) : hProcess(hProcess), stream(stream) {}
};
EnumModulesContext(HANDLE hProcess, QTextStream &stream) : hProcess(hProcess), stream(stream) {}
};
-BOOL CALLBACK EnumModulesCB(
PCT
STR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
+BOOL CALLBACK EnumModulesCB(
LPC
STR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
IMAGEHLP_MODULE64 mod;
EnumModulesContext *context = (EnumModulesContext *)UserContext;
mod.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
IMAGEHLP_MODULE64 mod;
EnumModulesContext *context = (EnumModulesContext *)UserContext;
mod.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
@@
-70,14
+70,12
@@
BOOL CALLBACK EnumModulesCB(PCTSTR ModuleName, DWORD64 BaseOfDll, PVOID UserCont
return TRUE;
}
return TRUE;
}
-// we don't use the ModuleName anyways so we can easily "convert" this
-inline BOOL CALLBACK EnumModulesCB(PSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
- return EnumModulesCB(PCTSTR(0), BaseOfDll, UserContext);
-}
-#ifdef _M_IX86
+
+#if defined( _M_IX86 ) && defined(Q_CC_MSVC)
// Disable global optimization and ignore /GS waning caused by
// inline assembly.
// Disable global optimization and ignore /GS waning caused by
// inline assembly.
+ // not needed with mingw cause we can tell mingw which registers we use
#pragma optimize("g", off)
#pragma warning(push)
#pragma warning(disable : 4748)
#pragma optimize("g", off)
#pragma warning(push)
#pragma warning(disable : 4748)
@@
-90,13
+88,26
@@
void Quassel::logBacktrace(const QString &filename) {
#ifdef _M_IX86
ZeroMemory(&Context, sizeof(CONTEXT));
Context.ContextFlags = CONTEXT_CONTROL;
#ifdef _M_IX86
ZeroMemory(&Context, sizeof(CONTEXT));
Context.ContextFlags = CONTEXT_CONTROL;
- __asm {
+
+
+#ifdef __MINGW32__
+ asm("Label:\n\t"
+ "movl %%ebp,%0;\n\t"
+ "movl %%esp,%1;\n\t"
+ "movl $Label,%%eax;\n\t"
+ "movl %%eax,%2;\n\t"
+ :"=r"(Context.Ebp),"=r"(Context.Esp),"=r"(Context.Eip)
+ ://no input
+ :"eax");
+#else
+ _asm {
Label:
mov [Context.Ebp], ebp;
mov [Context.Esp], esp;
mov eax, [Label];
mov [Context.Eip], eax;
}
Label:
mov [Context.Ebp], ebp;
mov [Context.Esp], esp;
mov eax, [Label];
mov [Context.Eip], eax;
}
+#endif
#else
RtlCaptureContext(&Context);
#endif
#else
RtlCaptureContext(&Context);
#endif
@@
-202,7
+213,7
@@
void Quassel::logBacktrace(const QString &filename) {
logFile.close();
}
logFile.close();
}
-#if
def _M_IX86
+#if
defined(_M_IX86) && defined(Q_CC_MSVC)
#pragma warning(pop)
#pragma optimize("g", on)
#endif
#pragma warning(pop)
#pragma optimize("g", on)
#endif