CDB: Use maxStackDepth and implement reload full stack.

Task-number: QTCREATORBUG-7320

Change-Id: I78bf8cf63fa892f2a6771911333c246839439bf4
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Friedemann Kleint
2013-01-31 14:34:16 +01:00
committed by hjk
parent 0a35cae99d
commit 2970a036d8
6 changed files with 46 additions and 17 deletions

View File

@@ -572,19 +572,30 @@ std::wstring memoryToHexW(CIDebugDataSpaces *ds, ULONG64 address, ULONG length,
static StackFrames getStackTrace(CIDebugControl *debugControl,
CIDebugSymbols *debugSymbols,
unsigned maxFrames,
bool *incomplete,
std::string *errorMessage)
{
if (!maxFrames)
if (maxFrames) {
*incomplete = false;
} else {
*incomplete = true;
return StackFrames();
DEBUG_STACK_FRAME *frames = new DEBUG_STACK_FRAME[maxFrames];
}
// Ask for one more frame to find out whether it is a complete listing.
const unsigned askedFrames = maxFrames + 1;
DEBUG_STACK_FRAME *frames = new DEBUG_STACK_FRAME[askedFrames];
ULONG frameCount = 0;
const HRESULT hr = debugControl->GetStackTrace(0, 0, 0, frames, maxFrames, &frameCount);
const HRESULT hr = debugControl->GetStackTrace(0, 0, 0, frames, askedFrames, &frameCount);
if (FAILED(hr)) {
delete [] frames;
*errorMessage = msgDebugEngineComFailed("GetStackTrace", hr);
return StackFrames();
}
if (askedFrames == frameCount) {
--frameCount;
*incomplete = true;
}
StackFrames rc(frameCount, StackFrame());
for (ULONG f = 0; f < frameCount; ++f)
getFrame(debugSymbols, frames[f], &(rc[f]));
@@ -597,8 +608,9 @@ std::string gdbmiStack(CIDebugControl *debugControl,
unsigned maxFrames,
bool humanReadable, std::string *errorMessage)
{
bool incomplete;
const StackFrames frames = getStackTrace(debugControl, debugSymbols,
maxFrames, errorMessage);
maxFrames, &incomplete, errorMessage);
if (frames.empty() && maxFrames > 0)
return std::string();
@@ -612,6 +624,8 @@ std::string gdbmiStack(CIDebugControl *debugControl,
if (humanReadable)
str << '\n';
}
if (incomplete) // Empty elements indicates incomplete.
str <<",{}";
str << ']';
return str.str();
}