forked from qt-creator/qt-creator
CDB: Pass settings maxStringLength and maxStackDepth to extension.
Change-Id: I602aa3758817026c8b4cbda1cc9fa9eff95fc691 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -43,6 +43,16 @@ WINDBG_EXTENSION_APIS ExtensionApis = {sizeof(WINDBG_EXTENSION_APIS), 0, 0, 0,
|
|||||||
const char *ExtensionContext::stopReasonKeyC = "reason";
|
const char *ExtensionContext::stopReasonKeyC = "reason";
|
||||||
const char *ExtensionContext::breakPointStopReasonC = "breakpoint";
|
const char *ExtensionContext::breakPointStopReasonC = "breakpoint";
|
||||||
|
|
||||||
|
/*! \class Parameters
|
||||||
|
|
||||||
|
Externally configureable parameters.
|
||||||
|
\ingroup qtcreatorcdbext
|
||||||
|
*/
|
||||||
|
|
||||||
|
Parameters::Parameters() : maxStringLength(10000), maxStackDepth(1000)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*! \class ExtensionContext
|
/*! \class ExtensionContext
|
||||||
|
|
||||||
Global singleton with context.
|
Global singleton with context.
|
||||||
|
|||||||
@@ -40,6 +40,16 @@ class LocalsSymbolGroup;
|
|||||||
class WatchesSymbolGroup;
|
class WatchesSymbolGroup;
|
||||||
class OutputCallback;
|
class OutputCallback;
|
||||||
|
|
||||||
|
// Global parameters
|
||||||
|
class Parameters
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Parameters();
|
||||||
|
|
||||||
|
unsigned maxStringLength;
|
||||||
|
unsigned maxStackDepth;
|
||||||
|
};
|
||||||
|
|
||||||
// Global singleton with context.
|
// Global singleton with context.
|
||||||
// Caches a symbolgroup per frame and thread as long as the session is accessible.
|
// Caches a symbolgroup per frame and thread as long as the session is accessible.
|
||||||
class ExtensionContext {
|
class ExtensionContext {
|
||||||
@@ -105,6 +115,9 @@ public:
|
|||||||
|
|
||||||
CIDebugClient *hookedClient() const { return m_hookedClient; }
|
CIDebugClient *hookedClient() const { return m_hookedClient; }
|
||||||
|
|
||||||
|
const Parameters ¶meters() const { return m_parameters; }
|
||||||
|
Parameters ¶meters() { return m_parameters; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isInitialized() const;
|
bool isInitialized() const;
|
||||||
|
|
||||||
@@ -120,6 +133,7 @@ private:
|
|||||||
|
|
||||||
StopReasonMap m_stopReason;
|
StopReasonMap m_stopReason;
|
||||||
bool m_stateNotification;
|
bool m_stateNotification;
|
||||||
|
Parameters m_parameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Context for extension commands to be instantiated on stack in a command handler.
|
// Context for extension commands to be instantiated on stack in a command handler.
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ threads
|
|||||||
registers
|
registers
|
||||||
modules
|
modules
|
||||||
idle
|
idle
|
||||||
|
setparameter
|
||||||
help
|
help
|
||||||
memory
|
memory
|
||||||
expression
|
expression
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ enum Command {
|
|||||||
CmdAddWatch,
|
CmdAddWatch,
|
||||||
CmdWidgetAt,
|
CmdWidgetAt,
|
||||||
CmdBreakPoints,
|
CmdBreakPoints,
|
||||||
CmdTest
|
CmdTest,
|
||||||
|
CmdSetParameter
|
||||||
};
|
};
|
||||||
|
|
||||||
static const CommandDescription commandDescriptions[] = {
|
static const CommandDescription commandDescriptions[] = {
|
||||||
@@ -172,7 +173,8 @@ static const CommandDescription commandDescriptions[] = {
|
|||||||
{"addwatch","Add watch expression","<iname> <expression>"},
|
{"addwatch","Add watch expression","<iname> <expression>"},
|
||||||
{"widgetat","Return address of widget at position","<x> <y>"},
|
{"widgetat","Return address of widget at position","<x> <y>"},
|
||||||
{"breakpoints","List breakpoints with modules","[-h] [-v]"},
|
{"breakpoints","List breakpoints with modules","[-h] [-v]"},
|
||||||
{"test","Testing command","-T type | -w watch-expression"}
|
{"test","Testing command","-T type | -w watch-expression"},
|
||||||
|
{"setparameter","Set parameter","maxStringLength=value maxStackDepth=value"}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<std::string> StringVector;
|
typedef std::vector<std::string> StringVector;
|
||||||
@@ -893,6 +895,34 @@ extern "C" HRESULT CALLBACK idle(CIDebugClient *client, PCSTR)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extension command 'setparameter':
|
||||||
|
// Parse a list of parameters: 'key=value'
|
||||||
|
|
||||||
|
extern "C" HRESULT CALLBACK setparameter(CIDebugClient *, PCSTR args)
|
||||||
|
{
|
||||||
|
int token;
|
||||||
|
StringVector tokens = commandTokens<StringVector>(args, &token);
|
||||||
|
const size_t count = tokens.size();
|
||||||
|
size_t success = 0;
|
||||||
|
for (size_t i = 0; i < count; ++i) {
|
||||||
|
const std::string &token = tokens.at(i);
|
||||||
|
const std::string::size_type equalsPos = token.find('=');
|
||||||
|
if (equalsPos != std::string::npos) {
|
||||||
|
const std::string value = token.substr(equalsPos + 1, token.size() - 1 - equalsPos);
|
||||||
|
if (!token.compare(0, equalsPos, "maxStringLength")) {
|
||||||
|
if (integerFromString(value, &ExtensionContext::instance().parameters().maxStringLength))
|
||||||
|
++success;
|
||||||
|
} else if (!token.compare(0, equalsPos, "maxStackDepth")) {
|
||||||
|
if (integerFromString(value, &ExtensionContext::instance().parameters().maxStackDepth))
|
||||||
|
++success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (success != count)
|
||||||
|
DebugPrint() << "Errors parsing setparameters command '" << args << '\'';
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Extension command 'help':
|
// Extension command 'help':
|
||||||
// Display version
|
// Display version
|
||||||
|
|
||||||
|
|||||||
@@ -783,6 +783,11 @@ void CdbEngine::setupInferior()
|
|||||||
}
|
}
|
||||||
postCommand("sxn 0x4000001f", 0); // Do not break on WowX86 exceptions.
|
postCommand("sxn 0x4000001f", 0); // Do not break on WowX86 exceptions.
|
||||||
postCommand(".asm source_line", 0); // Source line in assembly
|
postCommand(".asm source_line", 0); // Source line in assembly
|
||||||
|
postCommand(m_extensionCommandPrefixBA + "setparameter maxStringLength="
|
||||||
|
+ debuggerCore()->action(MaximalStringLength)->value().toByteArray()
|
||||||
|
+ " maxStackDepth="
|
||||||
|
+ debuggerCore()->action(MaximalStackDepth)->value().toByteArray()
|
||||||
|
, 0);
|
||||||
postExtensionCommand("pid", QByteArray(), 0, &CdbEngine::handlePid);
|
postExtensionCommand("pid", QByteArray(), 0, &CdbEngine::handlePid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user