diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2009-10-06 15:50:48 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2009-10-06 15:50:48 +0200 |
commit | c70f968faca095ef55732db5dfa87b4028865605 (patch) | |
tree | b6c408bf75be6d9aa68fc7b32107f3a3a85cf8f7 /src/plugins/debugger/cdb/cdbstacktracecontext.cpp | |
parent | 1110b622e2586bb1bb417cff87eca904136b4a98 (diff) | |
download | qt-creator-c70f968faca095ef55732db5dfa87b4028865605.tar.gz |
CDB: Fix step into, improve multithread dumping, exception logging
Use new call syntax of 6.11. for dumper call loading. Execute
Dumpers in a single thread (current) if at all possible (not
in some WaitFor or artificial break thread). Show one more
frame in threads view if it is FastCallReturn. Fix step into
(ignore one event), log some more exceptions. Generally log
exceptions to the debugger windows to be able to see stuff
like DLL missing, etc.
Diffstat (limited to 'src/plugins/debugger/cdb/cdbstacktracecontext.cpp')
-rw-r--r-- | src/plugins/debugger/cdb/cdbstacktracecontext.cpp | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/src/plugins/debugger/cdb/cdbstacktracecontext.cpp b/src/plugins/debugger/cdb/cdbstacktracecontext.cpp index 8cf72461fe..605eeb61db 100644 --- a/src/plugins/debugger/cdb/cdbstacktracecontext.cpp +++ b/src/plugins/debugger/cdb/cdbstacktracecontext.cpp @@ -40,6 +40,10 @@ namespace Debugger { namespace Internal { +const char *CdbStackTraceContext::winFuncFastSystemCallRet = "ntdll!KiFastSystemCallRet"; +const char *CdbStackTraceContext::winFuncDebugBreakPoint = "ntdll!DbgBreakPoint"; +const char *CdbStackTraceContext::winFuncWaitForPrefix = "kernel32!WaitFor"; + CdbStackTraceContext::CdbStackTraceContext(const QSharedPointer<CdbDumperHelper> &dumper) : m_dumper(dumper), m_cif(dumper->comInterfaces()), @@ -232,6 +236,7 @@ static inline bool getStoppedThreadState(const CdbComInterfaces &cif, ThreadData *t, QString *errorMessage) { + enum { MaxFrames = 2 }; ULONG currentThread; HRESULT hr = cif.debugSystemObjects->GetCurrentThreadId(¤tThread); if (FAILED(hr)) { @@ -246,29 +251,38 @@ static inline bool getStoppedThreadState(const CdbComInterfaces &cif, } } ULONG frameCount; - DEBUG_STACK_FRAME topFrame[1]; - hr = cif.debugControl->GetStackTrace(0, 0, 0, topFrame, 1, &frameCount); + // Ignore the top frame if it is "ntdll!KiFastSystemCallRet", which is + // not interesting for display. + DEBUG_STACK_FRAME frames[MaxFrames]; + hr = cif.debugControl->GetStackTrace(0, 0, 0, frames, MaxFrames, &frameCount); if (FAILED(hr)) { *errorMessage = msgGetThreadStateFailed(t->id, msgComFailed("GetStackTrace", hr)); return false; } - - t->address = topFrame[0].InstructionOffset; + // Ignore the top frame if it is "ntdll!KiFastSystemCallRet", which is + // not interesting for display. WCHAR wszBuf[MAX_PATH]; - - cif.debugSymbols->GetNameByOffsetWide(topFrame[0].InstructionOffset, wszBuf, MAX_PATH, 0, 0); - t->function = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); - ULONG ulLine; - hr = cif.debugSymbols->GetLineByOffsetWide(topFrame[0].InstructionOffset, &ulLine, wszBuf, MAX_PATH, 0, 0); - if (SUCCEEDED(hr)) { - t->line = ulLine; - // Just display base name - t->file = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); - if (!t->file.isEmpty()) { - const int slashPos = t->file.lastIndexOf(QLatin1Char('\\')); - if (slashPos != -1) - t->file.remove(0, slashPos + 1); - } + for (int frame = 0; frame < MaxFrames; frame++) { + cif.debugSymbols->GetNameByOffsetWide(frames[frame].InstructionOffset, wszBuf, MAX_PATH, 0, 0); + t->function = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); + if (frame != 0 || t->function != QLatin1String(CdbStackTraceContext::winFuncFastSystemCallRet)) { + t->address = frames[frame].InstructionOffset; + cif.debugSymbols->GetNameByOffsetWide(frames[frame].InstructionOffset, wszBuf, MAX_PATH, 0, 0); + t->function = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); + ULONG ulLine; + hr = cif.debugSymbols->GetLineByOffsetWide(frames[frame].InstructionOffset, &ulLine, wszBuf, MAX_PATH, 0, 0); + if (SUCCEEDED(hr)) { + t->line = ulLine; + // Just display base name + t->file = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); + if (!t->file.isEmpty()) { + const int slashPos = t->file.lastIndexOf(QLatin1Char('\\')); + if (slashPos != -1) + t->file.remove(0, slashPos + 1); + } + } + break; + } // was not "ntdll!KiFastSystemCallRet" } return true; } |