forked from qt-creator/qt-creator
Debugger: add option to disable task entries for exceptions
Task-number: QTCREATORBUG-20915 Change-Id: I3b7bda65f5b645cd4d8f9582b9185cb27b2c9f91 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -173,14 +173,16 @@ STDMETHODIMP EventCallback::Exception(
|
|||||||
__in ULONG FirstChance
|
__in ULONG FirstChance
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if ((FirstChance && ExtensionContext::instance().parameters().firstChanceException != 0)
|
||||||
|
|| (!FirstChance && ExtensionContext::instance().parameters().secondChanceException != 0)) {
|
||||||
// Report the exception as GBMI and set potential stop reason
|
// Report the exception as GBMI and set potential stop reason
|
||||||
const ExtensionContext::StopReasonMap parameters =
|
const ExtensionContext::StopReasonMap parameters = exceptionParameters(*Ex, FirstChance);
|
||||||
exceptionParameters(*Ex, FirstChance);
|
|
||||||
|
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
formatGdbmiHash(str, parameters);
|
formatGdbmiHash(str, parameters);
|
||||||
ExtensionContext::instance().setStopReason(parameters, "exception");
|
ExtensionContext::instance().setStopReason(parameters, "exception");
|
||||||
ExtensionContext::instance().report('E', 0, 0, "exception", "%s", str.str().c_str());
|
ExtensionContext::instance().report('E', 0, 0, "exception", "%s", str.str().c_str());
|
||||||
|
}
|
||||||
return m_wrapped ? m_wrapped->Exception(Ex, FirstChance) : S_OK;
|
return m_wrapped ? m_wrapped->Exception(Ex, FirstChance) : S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,8 @@ struct Parameters
|
|||||||
unsigned maxStringLength = 10000;
|
unsigned maxStringLength = 10000;
|
||||||
unsigned maxArraySize = 100;
|
unsigned maxArraySize = 100;
|
||||||
unsigned maxStackDepth = 1000;
|
unsigned maxStackDepth = 1000;
|
||||||
|
unsigned firstChanceException = 1;
|
||||||
|
unsigned secondChanceException = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Global singleton with context.
|
// Global singleton with context.
|
||||||
|
@@ -965,6 +965,12 @@ extern "C" HRESULT CALLBACK setparameter(CIDebugClient *, PCSTR args)
|
|||||||
} else if (!token.compare(0, equalsPos, "maxArraySize")) {
|
} else if (!token.compare(0, equalsPos, "maxArraySize")) {
|
||||||
if (integerFromString(value, &ExtensionContext::instance().parameters().maxArraySize))
|
if (integerFromString(value, &ExtensionContext::instance().parameters().maxArraySize))
|
||||||
++success;
|
++success;
|
||||||
|
} else if (!token.compare(0, equalsPos, "firstChance")) {
|
||||||
|
if (integerFromString(value, &ExtensionContext::instance().parameters().firstChanceException))
|
||||||
|
++success;
|
||||||
|
} else if (!token.compare(0, equalsPos, "secondChance")) {
|
||||||
|
if (integerFromString(value, &ExtensionContext::instance().parameters().secondChanceException))
|
||||||
|
++success;
|
||||||
} else if (!token.compare(0, equalsPos, "maxStackDepth")) {
|
} else if (!token.compare(0, equalsPos, "maxStackDepth")) {
|
||||||
if (integerFromString(value, &ExtensionContext::instance().parameters().maxStackDepth))
|
if (integerFromString(value, &ExtensionContext::instance().parameters().maxStackDepth))
|
||||||
++success;
|
++success;
|
||||||
|
@@ -539,10 +539,12 @@ void CdbEngine::handleInitialSessionIdle()
|
|||||||
runCommand({"sxn 0x4000001f", NoFlags}); // Do not break on WowX86 exceptions.
|
runCommand({"sxn 0x4000001f", NoFlags}); // Do not break on WowX86 exceptions.
|
||||||
runCommand({"sxn ibp", NoFlags}); // Do not break on initial breakpoints.
|
runCommand({"sxn ibp", NoFlags}); // Do not break on initial breakpoints.
|
||||||
runCommand({".asm source_line", NoFlags}); // Source line in assembly
|
runCommand({".asm source_line", NoFlags}); // Source line in assembly
|
||||||
runCommand({m_extensionCommandPrefix + "setparameter maxStringLength="
|
runCommand({m_extensionCommandPrefix
|
||||||
+ action(MaximalStringLength)->value().toString()
|
+ "setparameter maxStringLength=" + action(MaximalStringLength)->value().toString()
|
||||||
+ " maxStackDepth="
|
+ " maxStackDepth=" + action(MaximalStackDepth)->value().toString()
|
||||||
+ action(MaximalStackDepth)->value().toString(), NoFlags});
|
+ " firstChance=" + (action(FirstChanceExceptionTaskEntry)->value().toBool() ? "1" : "0")
|
||||||
|
+ " secondChance=" + (action(SecondChanceExceptionTaskEntry)->value().toBool() ? "1" : "0")
|
||||||
|
, NoFlags});
|
||||||
|
|
||||||
if (boolSetting(CdbUsePythonDumper))
|
if (boolSetting(CdbUsePythonDumper))
|
||||||
runCommand({"print(sys.version)", ScriptCommand, CB(setupScripting)});
|
runCommand({"print(sys.version)", ScriptCommand, CB(setupScripting)});
|
||||||
@@ -2195,12 +2197,11 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QString &what, c
|
|||||||
if (!isDebuggerWinException(exception.exceptionCode)) {
|
if (!isDebuggerWinException(exception.exceptionCode)) {
|
||||||
const Task::TaskType type =
|
const Task::TaskType type =
|
||||||
isFatalWinException(exception.exceptionCode) ? Task::Error : Task::Warning;
|
isFatalWinException(exception.exceptionCode) ? Task::Error : Task::Warning;
|
||||||
const FileName fileName = exception.file.isEmpty()
|
const FileName fileName = FileName::fromUserInput(exception.file);
|
||||||
? FileName() : FileName::fromUserInput(exception.file);
|
|
||||||
const QString taskEntry = tr("Debugger encountered an exception: %1").arg(
|
const QString taskEntry = tr("Debugger encountered an exception: %1").arg(
|
||||||
exception.toString(false).trimmed());
|
exception.toString(false).trimmed());
|
||||||
TaskHub::addTask(type, taskEntry,
|
TaskHub::addTask(type, taskEntry,
|
||||||
Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME,
|
Constants::TASK_CATEGORY_DEBUGGER_RUNTIME,
|
||||||
fileName, exception.lineNumber);
|
fileName, exception.lineNumber);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@@ -183,6 +183,8 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent)
|
|||||||
group.insert(action(UseCdbConsole), m_ui.consoleCheckBox);
|
group.insert(action(UseCdbConsole), m_ui.consoleCheckBox);
|
||||||
group.insert(action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox);
|
group.insert(action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox);
|
||||||
group.insert(action(CdbUsePythonDumper), m_ui.usePythonDumper);
|
group.insert(action(CdbUsePythonDumper), m_ui.usePythonDumper);
|
||||||
|
group.insert(action(FirstChanceExceptionTaskEntry), m_ui.firstChance);
|
||||||
|
group.insert(action(SecondChanceExceptionTaskEntry), m_ui.secondChance);
|
||||||
group.insert(action(IgnoreFirstChanceAccessViolation),
|
group.insert(action(IgnoreFirstChanceAccessViolation),
|
||||||
m_ui.ignoreFirstChanceAccessViolationCheckBox);
|
m_ui.ignoreFirstChanceAccessViolationCheckBox);
|
||||||
|
|
||||||
|
@@ -103,6 +103,35 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="exceptions">
|
||||||
|
<property name="title">
|
||||||
|
<string>Task Entries for Exceptions </string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="firstChance">
|
||||||
|
<property name="text">
|
||||||
|
<string>First chance exceptions</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="secondChance">
|
||||||
|
<property name="text">
|
||||||
|
<string>Second chance exceptions</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@@ -232,6 +232,18 @@ DebuggerSettings::DebuggerSettings()
|
|||||||
item->setSettingsKey(cdbSettingsGroup, QLatin1String("UsePythonDumper"));
|
item->setSettingsKey(cdbSettingsGroup, QLatin1String("UsePythonDumper"));
|
||||||
insertItem(CdbUsePythonDumper, item);
|
insertItem(CdbUsePythonDumper, item);
|
||||||
|
|
||||||
|
item = new SavedAction(this);
|
||||||
|
item->setCheckable(true);
|
||||||
|
item->setDefaultValue(true);
|
||||||
|
item->setSettingsKey(cdbSettingsGroup, QLatin1String("FirstChanceExceptionTaskEntry"));
|
||||||
|
insertItem(FirstChanceExceptionTaskEntry, item);
|
||||||
|
|
||||||
|
item = new SavedAction(this);
|
||||||
|
item->setCheckable(true);
|
||||||
|
item->setDefaultValue(true);
|
||||||
|
item->setSettingsKey(cdbSettingsGroup, QLatin1String("SecondChanceExceptionTaskEntry"));
|
||||||
|
insertItem(SecondChanceExceptionTaskEntry, item);
|
||||||
|
|
||||||
item = new SavedAction(this);
|
item = new SavedAction(this);
|
||||||
item->setCheckable(true);
|
item->setCheckable(true);
|
||||||
item->setDefaultValue(false);
|
item->setDefaultValue(false);
|
||||||
|
@@ -117,6 +117,8 @@ enum DebuggerActionCode
|
|||||||
UseCdbConsole,
|
UseCdbConsole,
|
||||||
CdbBreakPointCorrection,
|
CdbBreakPointCorrection,
|
||||||
CdbUsePythonDumper,
|
CdbUsePythonDumper,
|
||||||
|
FirstChanceExceptionTaskEntry,
|
||||||
|
SecondChanceExceptionTaskEntry,
|
||||||
IgnoreFirstChanceAccessViolation,
|
IgnoreFirstChanceAccessViolation,
|
||||||
|
|
||||||
// Gdb
|
// Gdb
|
||||||
|
Reference in New Issue
Block a user