Add debugger option to break on unlogged code
This commit is contained in:
parent
708a13b1c7
commit
739d1ba041
10 changed files with 1899 additions and 1861 deletions
|
@ -146,6 +146,12 @@ CdlRatios CodeDataLogger::GetRatios()
|
||||||
return ratios;
|
return ratios;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CodeDataLogger::IsNone(uint32_t absoluteAddr)
|
||||||
|
{
|
||||||
|
return _cdlData[absoluteAddr] == (uint8_t)CdlPrgFlags::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CodeDataLogger::IsCode(uint32_t absoluteAddr)
|
bool CodeDataLogger::IsCode(uint32_t absoluteAddr)
|
||||||
{
|
{
|
||||||
return (_cdlData[absoluteAddr] & (uint8_t)CdlPrgFlags::Code) == (uint8_t)CdlPrgFlags::Code;
|
return (_cdlData[absoluteAddr] & (uint8_t)CdlPrgFlags::Code) == (uint8_t)CdlPrgFlags::Code;
|
||||||
|
|
|
@ -80,6 +80,7 @@ public:
|
||||||
|
|
||||||
CdlRatios GetRatios();
|
CdlRatios GetRatios();
|
||||||
|
|
||||||
|
bool IsNone(uint32_t absoluteAddr);
|
||||||
bool IsCode(uint32_t absoluteAddr);
|
bool IsCode(uint32_t absoluteAddr);
|
||||||
bool IsJumpTarget(uint32_t absoluteAddr);
|
bool IsJumpTarget(uint32_t absoluteAddr);
|
||||||
bool IsSubEntryPoint(uint32_t absoluteAddr);
|
bool IsSubEntryPoint(uint32_t absoluteAddr);
|
||||||
|
|
|
@ -767,6 +767,7 @@ bool Debugger::ProcessRamOperation(MemoryOperationType type, uint16_t &addr, uin
|
||||||
AddressTypeInfo addressInfo;
|
AddressTypeInfo addressInfo;
|
||||||
GetAbsoluteAddressAndType(addr, &addressInfo);
|
GetAbsoluteAddressAndType(addr, &addressInfo);
|
||||||
int32_t absoluteAddr = addressInfo.Type == AddressType::PrgRom ? addressInfo.Address : -1;
|
int32_t absoluteAddr = addressInfo.Type == AddressType::PrgRom ? addressInfo.Address : -1;
|
||||||
|
bool isUnlogged = absoluteAddr >= 0 ? _codeDataLogger->IsNone(absoluteAddr) : false;
|
||||||
if(addressInfo.Type == AddressType::PrgRom && addressInfo.Address >= 0 && type != MemoryOperationType::DummyRead && type != MemoryOperationType::DummyWrite && _runToCycle == -1) {
|
if(addressInfo.Type == AddressType::PrgRom && addressInfo.Address >= 0 && type != MemoryOperationType::DummyRead && type != MemoryOperationType::DummyWrite && _runToCycle == -1) {
|
||||||
if(type == MemoryOperationType::ExecOperand) {
|
if(type == MemoryOperationType::ExecOperand) {
|
||||||
_codeDataLogger->SetFlag(absoluteAddr, CdlPrgFlags::Code);
|
_codeDataLogger->SetFlag(absoluteAddr, CdlPrgFlags::Code);
|
||||||
|
@ -820,6 +821,9 @@ bool Debugger::ProcessRamOperation(MemoryOperationType type, uint16_t &addr, uin
|
||||||
} else if(CheckFlag(DebuggerFlags::BreakOnUnofficialOpCode) && _disassembler->IsUnofficialOpCode(value)) {
|
} else if(CheckFlag(DebuggerFlags::BreakOnUnofficialOpCode) && _disassembler->IsUnofficialOpCode(value)) {
|
||||||
Step(1);
|
Step(1);
|
||||||
breakSource = BreakSource::BreakOnUnofficialOpCode;
|
breakSource = BreakSource::BreakOnUnofficialOpCode;
|
||||||
|
} else if(CheckFlag(DebuggerFlags::BreakOnUnlogged) && isUnlogged && type == MemoryOperationType::ExecOpCode && absoluteAddr >= 0) {
|
||||||
|
Step(1);
|
||||||
|
breakSource = BreakSource::BreakOnUnlogged;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_runToCycle != -1) {
|
if(_runToCycle != -1) {
|
||||||
|
|
|
@ -43,6 +43,7 @@ enum class DebuggerFlags
|
||||||
|
|
||||||
BreakOnPpu2006ScrollGlitch = 0x20000,
|
BreakOnPpu2006ScrollGlitch = 0x20000,
|
||||||
BreakOnBusConflict = 0x40000,
|
BreakOnBusConflict = 0x40000,
|
||||||
|
BreakOnUnlogged = 0x80000,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class BreakSource
|
enum class BreakSource
|
||||||
|
@ -61,7 +62,8 @@ enum class BreakSource
|
||||||
Pause = 10,
|
Pause = 10,
|
||||||
BreakAfterSuspend = 11,
|
BreakAfterSuspend = 11,
|
||||||
BreakOnPpu2006ScrollGlitch = 12,
|
BreakOnPpu2006ScrollGlitch = 12,
|
||||||
BreakOnBusConflict = 13
|
BreakOnBusConflict = 13,
|
||||||
|
BreakOnUnlogged = 14
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class AddressType
|
enum class AddressType
|
||||||
|
|
|
@ -354,6 +354,7 @@ namespace Mesen.GUI.Config
|
||||||
public bool BreakOnInit = true;
|
public bool BreakOnInit = true;
|
||||||
public bool BreakOnPlay = false;
|
public bool BreakOnPlay = false;
|
||||||
public bool BreakOnFirstCycle = true;
|
public bool BreakOnFirstCycle = true;
|
||||||
|
public bool BreakOnUnlogged = false;
|
||||||
|
|
||||||
public bool BringToFrontOnPause = false;
|
public bool BringToFrontOnPause = false;
|
||||||
public bool BringToFrontOnBreak = true;
|
public bool BringToFrontOnBreak = true;
|
||||||
|
|
3727
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
3727
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -108,6 +108,7 @@ namespace Mesen.GUI.Debugger
|
||||||
this.mnuBreakOnPlay.Checked = ConfigManager.Config.DebugInfo.BreakOnPlay;
|
this.mnuBreakOnPlay.Checked = ConfigManager.Config.DebugInfo.BreakOnPlay;
|
||||||
this.mnuBreakOnOpen.Checked = ConfigManager.Config.DebugInfo.BreakOnOpen;
|
this.mnuBreakOnOpen.Checked = ConfigManager.Config.DebugInfo.BreakOnOpen;
|
||||||
this.mnuBreakOnUnofficialOpcodes.Checked = ConfigManager.Config.DebugInfo.BreakOnUnofficialOpcodes;
|
this.mnuBreakOnUnofficialOpcodes.Checked = ConfigManager.Config.DebugInfo.BreakOnUnofficialOpcodes;
|
||||||
|
this.mnuBreakOnUnlogged.Checked = ConfigManager.Config.DebugInfo.BreakOnUnlogged;
|
||||||
this.mnuBreakOnBrk.Checked = ConfigManager.Config.DebugInfo.BreakOnBrk;
|
this.mnuBreakOnBrk.Checked = ConfigManager.Config.DebugInfo.BreakOnBrk;
|
||||||
this.mnuBreakOnUninitMemoryRead.Checked = ConfigManager.Config.DebugInfo.BreakOnUninitMemoryRead;
|
this.mnuBreakOnUninitMemoryRead.Checked = ConfigManager.Config.DebugInfo.BreakOnUninitMemoryRead;
|
||||||
this.mnuBreakOnBusConflict.Checked = ConfigManager.Config.DebugInfo.BreakOnBusConflict;
|
this.mnuBreakOnBusConflict.Checked = ConfigManager.Config.DebugInfo.BreakOnBusConflict;
|
||||||
|
@ -426,6 +427,7 @@ namespace Mesen.GUI.Debugger
|
||||||
SetFlag(DebuggerFlags.ShowVerifiedData, config.ShowVerifiedData);
|
SetFlag(DebuggerFlags.ShowVerifiedData, config.ShowVerifiedData);
|
||||||
SetFlag(DebuggerFlags.ShowUnidentifiedData, config.ShowUnidentifiedData);
|
SetFlag(DebuggerFlags.ShowUnidentifiedData, config.ShowUnidentifiedData);
|
||||||
SetFlag(DebuggerFlags.BreakOnUnofficialOpCode, config.BreakOnUnofficialOpcodes);
|
SetFlag(DebuggerFlags.BreakOnUnofficialOpCode, config.BreakOnUnofficialOpcodes);
|
||||||
|
SetFlag(DebuggerFlags.BreakOnUnlogged, config.BreakOnUnlogged);
|
||||||
SetFlag(DebuggerFlags.BreakOnBrk, config.BreakOnBrk);
|
SetFlag(DebuggerFlags.BreakOnBrk, config.BreakOnBrk);
|
||||||
SetFlag(DebuggerFlags.BreakOnUninitMemoryRead, config.BreakOnUninitMemoryRead);
|
SetFlag(DebuggerFlags.BreakOnUninitMemoryRead, config.BreakOnUninitMemoryRead);
|
||||||
SetFlag(DebuggerFlags.BreakOnDecayedOamRead, config.BreakOnDecayedOamRead);
|
SetFlag(DebuggerFlags.BreakOnDecayedOamRead, config.BreakOnDecayedOamRead);
|
||||||
|
@ -1178,6 +1180,13 @@ namespace Mesen.GUI.Debugger
|
||||||
UpdateDebuggerFlags();
|
UpdateDebuggerFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mnuBreakOnUnlogged_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ConfigManager.Config.DebugInfo.BreakOnUnlogged = mnuBreakOnUnlogged.Checked;
|
||||||
|
ConfigManager.ApplyChanges();
|
||||||
|
UpdateDebuggerFlags();
|
||||||
|
}
|
||||||
|
|
||||||
private void mnuBreakOnBrk_Click(object sender, EventArgs e)
|
private void mnuBreakOnBrk_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ConfigManager.Config.DebugInfo.BreakOnBrk = mnuBreakOnBrk.Checked;
|
ConfigManager.Config.DebugInfo.BreakOnBrk = mnuBreakOnBrk.Checked;
|
||||||
|
|
|
@ -121,12 +121,12 @@
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>107, 17</value>
|
<value>110, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>215, 17</value>
|
<value>222, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="tsToolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="tsToolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>324, 17</value>
|
<value>335, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
</root>
|
</root>
|
|
@ -1362,6 +1362,7 @@
|
||||||
<Value ID="PpuStep">PPU Step</Value>
|
<Value ID="PpuStep">PPU Step</Value>
|
||||||
<Value ID="BreakOnBrk">BRK</Value>
|
<Value ID="BreakOnBrk">BRK</Value>
|
||||||
<Value ID="BreakOnUnofficialOpCode">Unofficial OP code</Value>
|
<Value ID="BreakOnUnofficialOpCode">Unofficial OP code</Value>
|
||||||
|
<Value ID="BreakOnUnlogged">Unlogged code</Value>
|
||||||
<Value ID="BreakOnReset">Reset event</Value>
|
<Value ID="BreakOnReset">Reset event</Value>
|
||||||
<Value ID="BreakOnFocus">Debugger focused</Value>
|
<Value ID="BreakOnFocus">Debugger focused</Value>
|
||||||
<Value ID="BreakOnUninitMemoryRead">Uninitialized memory read</Value>
|
<Value ID="BreakOnUninitMemoryRead">Uninitialized memory read</Value>
|
||||||
|
|
|
@ -1734,6 +1734,7 @@ namespace Mesen.GUI
|
||||||
|
|
||||||
BreakOnPpu2006ScrollGlitch = 0x20000,
|
BreakOnPpu2006ScrollGlitch = 0x20000,
|
||||||
BreakOnBusConflict = 0x40000,
|
BreakOnBusConflict = 0x40000,
|
||||||
|
BreakOnUnlogged = 0x80000,
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct InteropRomInfo
|
public struct InteropRomInfo
|
||||||
|
|
Loading…
Add table
Reference in a new issue