forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user