~ubuntu-branches/ubuntu/saucy/quassel/saucy-proposed

« back to all changes in this revision

Viewing changes to src/common/logbacktrace_win.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-02-17 12:49:50 UTC
  • mto: This revision was merged to the branch mainline in revision 59.
  • Revision ID: james.westby@ubuntu.com-20100217124950-v9hajw5d2xa6fszn
Tags: upstream-0.6~beta1
ImportĀ upstreamĀ versionĀ 0.6~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
  EnumModulesContext(HANDLE hProcess, QTextStream &stream) : hProcess(hProcess), stream(stream) {}
50
50
};
51
51
 
52
 
BOOL CALLBACK EnumModulesCB(PCTSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
 
52
BOOL CALLBACK EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
53
53
  IMAGEHLP_MODULE64 mod;
54
54
  EnumModulesContext *context = (EnumModulesContext *)UserContext;
55
55
  mod.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
70
70
  return TRUE;
71
71
}
72
72
 
73
 
// we don't use the ModuleName anyways so we can easily "convert" this
74
 
inline BOOL CALLBACK EnumModulesCB(PSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
75
 
  return EnumModulesCB(PCTSTR(0), BaseOfDll, UserContext);
76
 
}
77
 
 
78
 
#ifdef _M_IX86
 
73
 
 
74
 
 
75
#if defined( _M_IX86 ) && defined(Q_CC_MSVC)
79
76
  // Disable global optimization and ignore /GS waning caused by
80
77
  // inline assembly.
 
78
  // not needed with mingw cause we can tell mingw which registers we use
81
79
  #pragma optimize("g", off)
82
80
  #pragma warning(push)
83
81
  #pragma warning(disable : 4748)
90
88
#ifdef _M_IX86
91
89
    ZeroMemory(&Context, sizeof(CONTEXT));
92
90
    Context.ContextFlags = CONTEXT_CONTROL;
93
 
    __asm {
 
91
 
 
92
 
 
93
#ifdef __MINGW32__
 
94
      asm("Label:\n\t"
 
95
        "movl %%ebp,%0;\n\t"
 
96
        "movl %%esp,%1;\n\t"
 
97
        "movl $Label,%%eax;\n\t"
 
98
        "movl %%eax,%2;\n\t"
 
99
        :"=r"(Context.Ebp),"=r"(Context.Esp),"=r"(Context.Eip)
 
100
        ://no input
 
101
        :"eax");
 
102
#else
 
103
    _asm {
94
104
    Label:
95
105
      mov [Context.Ebp], ebp;
96
106
      mov [Context.Esp], esp;
97
107
      mov eax, [Label];
98
108
      mov [Context.Eip], eax;
99
109
    }
 
110
#endif
100
111
#else
101
112
    RtlCaptureContext(&Context);
102
113
#endif
202
213
 
203
214
  logFile.close();
204
215
}
205
 
#ifdef _M_IX86
 
216
#if defined(_M_IX86) && defined(Q_CC_MSVC)
206
217
  #pragma warning(pop)
207
218
  #pragma optimize("g", on)
208
219
#endif