1
0
Fork 0

Added 'Silent' option for breakpoints

This commit is contained in:
justin 2016-07-08 13:33:24 -06:00
parent 4657786726
commit d3c31fd8de
11 changed files with 107 additions and 14 deletions

View File

@ -397,6 +397,7 @@ typedef struct
// extended part
unsigned int hitCount;
bool fastResume;
bool silent;
char breakCondition[MAX_CONDITIONAL_EXPR_SIZE];
char logText[MAX_CONDITIONAL_TEXT_SIZE];
char logCondition[MAX_CONDITIONAL_EXPR_SIZE];

View File

@ -308,6 +308,21 @@ bool BpSetFastResume(duint Address, BP_TYPE Type, bool fastResume)
return true;
}
bool BpSetSilent(duint Address, BP_TYPE Type, bool silent)
{
ASSERT_DEBUGGING("Command function call");
EXCLUSIVE_ACQUIRE(LockBreakpoints);
// Set breakpoint fast resume
BREAKPOINT* bpInfo = BpInfoFromAddr(Type, Address);
if(!bpInfo)
return false;
bpInfo->silent = silent;
return true;
}
bool BpEnumAll(BPENUMCALLBACK EnumCallback, const char* Module, duint base)
{
ASSERT_DEBUGGING("Export call");
@ -426,6 +441,7 @@ void BpToBridge(const BREAKPOINT* Bp, BRIDGEBP* BridgeBp)
BridgeBp->enabled = Bp->enabled;
BridgeBp->singleshoot = Bp->singleshoot;
BridgeBp->fastResume = Bp->fastResume;
BridgeBp->silent = Bp->silent;
BridgeBp->hitCount = Bp->hitcount;
switch(Bp->type)
@ -494,6 +510,7 @@ void BpCacheSave(JSON Root)
json_object_set_new(jsonObj, "commandText", json_string(breakpoint.commandText));
json_object_set_new(jsonObj, "commandCondition", json_string(breakpoint.commandCondition));
json_object_set_new(jsonObj, "fastResume", json_boolean(breakpoint.fastResume));
json_object_set_new(jsonObj, "silent", json_boolean(breakpoint.silent));
json_array_append_new(jsonBreakpoints, jsonObj);
}
@ -551,6 +568,7 @@ void BpCacheLoad(JSON Root)
// Fast resume
breakpoint.fastResume = json_boolean_value(json_object_get(value, "fastResume"));
breakpoint.silent = json_boolean_value(json_object_get(value, "silent"));
// Build the hash map key: MOD_HASH + ADDRESS
duint key = ModHashFromName(breakpoint.mod) + breakpoint.addr;

View File

@ -23,6 +23,7 @@ struct BREAKPOINT
bool enabled; // whether the breakpoint is enabled
bool singleshoot; // whether the breakpoint should be deleted on first hit
bool active; // whether the breakpoint is active or not
bool silent; // whether the breakpoint diplays a default message when hit
unsigned short oldbytes; // original bytes (for software breakpoitns)
BP_TYPE type; // breakpoint type
DWORD titantype; // type passed to titanengine
@ -56,6 +57,7 @@ bool BpSetCommandText(duint Address, BP_TYPE Type, const char* Cmd);
bool BpSetCommandCondition(duint Address, BP_TYPE Type, const char* Condition);
bool BpSetFastResume(duint Address, BP_TYPE Type, bool fastResume);
bool BpEnumAll(BPENUMCALLBACK EnumCallback, const char* Module, duint base = 0);
bool BpSetSilent(duint Address, BP_TYPE Type, bool silent);
bool BpEnumAll(BPENUMCALLBACK EnumCallback);
int BpGetCount(BP_TYPE Type, bool EnabledOnly = false);
uint32 BpGetHitCount(duint Address, BP_TYPE Type);

View File

@ -580,19 +580,22 @@ static void cbGenericBreakpoint(BP_TYPE bptype, void* ExceptionAddress = nullptr
{
if(bp.singleshoot)
BpDelete(bp.addr, bptype);
switch(bptype)
if(!bp.silent)
{
case BPNORMAL:
printSoftBpInfo(bp);
break;
case BPHARDWARE:
printHwBpInfo(bp);
break;
case BPMEMORY:
printMemBpInfo(bp, ExceptionAddress);
break;
default:
break;
switch(bptype)
{
case BPNORMAL:
printSoftBpInfo(bp);
break;
case BPHARDWARE:
printHwBpInfo(bp);
break;
case BPMEMORY:
printMemBpInfo(bp, ExceptionAddress);
break;
default:
break;
}
}
DebugUpdateGuiSetStateAsync(CIP, true);
}

View File

@ -594,6 +594,35 @@ static CMDRESULT cbDebugSetBPXFastResumeCommon(BP_TYPE Type, int argc, char* arg
return STATUS_CONTINUE;
}
static CMDRESULT cbDebugSetBPXSilentCommon(BP_TYPE Type, int argc, char* argv[])
{
BREAKPOINT bp;
if(argc < 2)
{
dprintf("not enough arguments!\n");
return STATUS_ERROR;
}
auto silent = true;
if(argc > 2)
{
duint value;
if(!valfromstring(argv[2], &value, false))
return STATUS_ERROR;
silent = value != 0;
}
if(!BpGetAny(Type, argv[1], &bp))
{
dprintf("No such breakpoint \"%s\"\n", argv[1]);
return STATUS_ERROR;
}
if(!BpSetSilent(bp.addr, Type, silent))
{
dprintf("Can't set fast resume on breakpoint \"%1\"", argv[1]);
return STATUS_ERROR;
}
return STATUS_CONTINUE;
}
CMDRESULT cbDebugSetBPXName(int argc, char* argv[])
{
return cbDebugSetBPXNameCommon(BPNORMAL, argc, argv);
@ -629,6 +658,11 @@ CMDRESULT cbDebugSetBPXFastResume(int argc, char* argv[])
return cbDebugSetBPXFastResumeCommon(BPNORMAL, argc, argv);
}
CMDRESULT cbDebugSetBPXSilent(int argc, char* argv[])
{
return cbDebugSetBPXSilentCommon(BPNORMAL, argc, argv);
}
CMDRESULT cbDebugResetBPXHitCount(int argc, char* argv[])
{
return cbDebugResetBPXHitCountCommon(BPNORMAL, argc, argv);
@ -669,6 +703,11 @@ CMDRESULT cbDebugSetBPXHardwareFastResume(int argc, char* argv[])
return cbDebugSetBPXFastResumeCommon(BPHARDWARE, argc, argv);
}
CMDRESULT cbDebugSetBPXHardwareSilent(int argc, char* argv[])
{
return cbDebugSetBPXSilentCommon(BPHARDWARE, argc, argv);
}
CMDRESULT cbDebugResetBPXHardwareHitCount(int argc, char* argv[])
{
return cbDebugResetBPXHitCountCommon(BPHARDWARE, argc, argv);
@ -706,12 +745,17 @@ CMDRESULT cbDebugSetBPXMemoryCommandCondition(int argc, char* argv[])
CMDRESULT cbDebugResetBPXMemoryHitCount(int argc, char* argv[])
{
return cbDebugSetBPXFastResumeCommon(BPMEMORY, argc, argv);
return cbDebugResetBPXHitCountCommon(BPMEMORY, argc, argv);
}
CMDRESULT cbDebugSetBPXMemoryFastResume(int argc, char* argv[])
{
return cbDebugResetBPXHitCountCommon(BPMEMORY, argc, argv);
return cbDebugSetBPXFastResumeCommon(BPMEMORY, argc, argv);
}
CMDRESULT cbDebugSetBPXMemorySilent(int argc, char* argv[])
{
return cbDebugSetBPXSilentCommon(BPMEMORY, argc, argv);
}
CMDRESULT cbDebugGetBPXMemoryHitCount(int argc, char* argv[])

View File

@ -23,6 +23,7 @@ CMDRESULT cbDebugSetBPXCommand(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXCommandCondition(int argc, char* argv[]);
CMDRESULT cbDebugGetBPXHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXFastResume(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXSilent(int argc, char* argv[]);
CMDRESULT cbDebugResetBPXHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetBPGoto(int argc, char* argv[]);
CMDRESULT cbDebugSetHardwareBreakpoint(int argc, char* argv[]);
@ -37,6 +38,7 @@ CMDRESULT cbDebugSetBPXHardwareCommand(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXHardwareCommandCondition(int argc, char* argv[]);
CMDRESULT cbDebugGetBPXHardwareHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXHardwareFastResume(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXHardwareSilent(int argc, char* argv[]);
CMDRESULT cbDebugResetBPXHardwareHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetMemoryBpx(int argc, char* argv[]);
CMDRESULT cbDebugDeleteMemoryBreakpoint(int argc, char* argv[]);
@ -50,6 +52,7 @@ CMDRESULT cbDebugSetBPXMemoryCommand(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXMemoryCommandCondition(int argc, char* argv[]);
CMDRESULT cbDebugGetBPXMemoryHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXMemoryFastResume(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXMemorySilent(int argc, char* argv[]);
CMDRESULT cbDebugResetBPXMemoryHitCount(int argc, char* argv[]);
CMDRESULT cbDebugBplist(int argc, char* argv[]);
CMDRESULT cbDebugStepInto(int argc, char* argv[]);

View File

@ -143,6 +143,7 @@ static void registercommands()
dbgcmdnew("SetBreakpointCommand", cbDebugSetBPXCommand, true); //set breakpoint command on hit
dbgcmdnew("SetBreakpointCommandCondition", cbDebugSetBPXCommandCondition, true); //set breakpoint commandCondition
dbgcmdnew("SetBreakpointFastResume", cbDebugSetBPXFastResume, true); //set breakpoint fast resume
dbgcmdnew("SetBreakpointSilent", cbDebugSetBPXSilent, true); //set breakpoint fast resume
dbgcmdnew("GetBreakpointHitCount", cbDebugGetBPXHitCount, true); //get breakpoint hit count
dbgcmdnew("ResetBreakpointHitCount", cbDebugResetBPXHitCount, true); //reset breakpoint hit count
dbgcmdnew("SetHardwareBreakpointName\1bphwname", cbDebugSetBPXHardwareName, true); //set breakpoint name
@ -152,6 +153,7 @@ static void registercommands()
dbgcmdnew("SetHardwareBreakpointCommand", cbDebugSetBPXHardwareCommand, true); //set breakpoint command on hit
dbgcmdnew("SetHardwareBreakpointCommandCondition", cbDebugSetBPXHardwareCommandCondition, true); //set breakpoint commandCondition
dbgcmdnew("SetHardwareBreakpointFastResume", cbDebugSetBPXHardwareFastResume, true); //set breakpoint fast resume
dbgcmdnew("SetHardwareBreakpointSilent", cbDebugSetBPXHardwareSilent, true); //set breakpoint fast resume
dbgcmdnew("GetHardwareBreakpointHitCount", cbDebugGetBPXHardwareHitCount, true); //get breakpoint hit count
dbgcmdnew("ResetHardwareBreakpointHitCount", cbDebugResetBPXHardwareHitCount, true); //reset breakpoint hit count
dbgcmdnew("SetMemoryBreakpointName\1bpmname", cbDebugSetBPXMemoryName, true); //set breakpoint name
@ -161,6 +163,7 @@ static void registercommands()
dbgcmdnew("SetMemoryBreakpointCommand", cbDebugSetBPXMemoryCommand, true); //set breakpoint command on hit
dbgcmdnew("SetMemoryBreakpointCommandCondition", cbDebugSetBPXMemoryCommandCondition, true); //set breakpoint commandCondition
dbgcmdnew("SetMemoryBreakpointFastResume", cbDebugSetBPXMemoryFastResume, true); //set breakpoint fast resume
dbgcmdnew("SetMemoryBreakpointSilent", cbDebugSetBPXMemorySilent, true); //set breakpoint fast resume
dbgcmdnew("SetMemoryGetBreakpointHitCount", cbDebugGetBPXMemoryHitCount, true); //get breakpoint hit count
dbgcmdnew("ResetMemoryBreakpointHitCount", cbDebugResetBPXMemoryHitCount, true); //reset breakpoint hit count

View File

@ -26,6 +26,7 @@ void EditBreakpointDialog::loadFromBp()
ui->spinHitCount->setValue(mBp.hitCount);
ui->editBreakCondition->setText(mBp.breakCondition);
ui->checkBoxFastResume->setChecked(mBp.fastResume);
ui->checkBoxSilent->setChecked(mBp.silent);
ui->editLogText->setText(mBp.logText);
ui->editLogCondition->setText(mBp.logCondition);
ui->editCommandText->setText(mBp.commandText);
@ -77,3 +78,8 @@ void EditBreakpointDialog::on_spinHitCount_valueChanged(int arg1)
{
mBp.hitCount = arg1;
}
void EditBreakpointDialog::on_checkBoxSilent_toggled(bool checked)
{
mBp.silent = checked;
}

View File

@ -31,6 +31,8 @@ private slots:
void on_checkBoxFastResume_toggled(bool checked);
void on_spinHitCount_valueChanged(int arg1);
void on_checkBoxSilent_toggled(bool checked);
private:
Ui::EditBreakpointDialog* ui;
BRIDGEBP mBp;

View File

@ -155,6 +155,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSilent">
<property name="text">
<string>&amp;Silent</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxFastResume">
<property name="text">
@ -188,6 +195,7 @@
<tabstop>editCommandCondition</tabstop>
<tabstop>editName</tabstop>
<tabstop>spinHitCount</tabstop>
<tabstop>checkBoxSilent</tabstop>
<tabstop>checkBoxFastResume</tabstop>
<tabstop>buttonSave</tabstop>
<tabstop>buttonCancel</tabstop>

View File

@ -433,6 +433,7 @@ void Breakpoints::editBP(BPXTYPE type, const QString & addrText, QWidget* widget
exec(QString("SetBreakpointCommandCondition %1, \"%2\"").arg(addrText).arg(bp.commandCondition));
exec(QString("ResetBreakpointHitCount %1, \"%2\"").arg(addrText).arg(bp.hitCount));
exec(QString("SetBreakpointFastResume %1, \"%2\"").arg(addrText).arg(bp.fastResume));
exec(QString("SetBreakpointSilent %1, \"%2\"").arg(addrText).arg(bp.silent));
break;
case bp_hardware:
exec(QString("SetHardwareBreakpointName %1, \"%2\"").arg(addrText).arg(bp.name));
@ -443,6 +444,7 @@ void Breakpoints::editBP(BPXTYPE type, const QString & addrText, QWidget* widget
exec(QString("SetHardwareBreakpointCommandCondition %1, \"%2\"").arg(addrText).arg(bp.commandCondition));
exec(QString("ResetHardwareBreakpointHitCount %1, %2").arg(addrText).arg(bp.hitCount));
exec(QString("SetHardwareBreakpointFastResume %1, %2").arg(addrText).arg(bp.fastResume));
exec(QString("SetHardwareBreakpointSilent %1, %2").arg(addrText).arg(bp.silent));
break;
case bp_memory:
exec(QString("SetMemoryBreakpointName %1, \"\"%2\"\"").arg(addrText).arg(bp.name));
@ -453,6 +455,7 @@ void Breakpoints::editBP(BPXTYPE type, const QString & addrText, QWidget* widget
exec(QString("SetMemoryBreakpointCommandCondition %1, \"%2\"").arg(addrText).arg(bp.commandCondition));
exec(QString("ResetMemoryBreakpointHitCount %1, %2").arg(addrText).arg(bp.hitCount));
exec(QString("SetMemoryBreakpointFastResume %1, %2").arg(addrText).arg(bp.fastResume));
exec(QString("SetMemoryBreakpointSilent %1, \"%2\"").arg(addrText).arg(bp.silent));
break;
default:
return;