Debugger: Trace Logger - Fixed log not displaying the right data when some CPUs were unchecked
This commit is contained in:
parent
6dd2862482
commit
f2b66882f7
4 changed files with 24 additions and 10 deletions
|
@ -392,7 +392,7 @@ const char* TraceLogger::GetExecutionTrace(uint32_t lineCount)
|
|||
lineCount = std::min(lineCount, _logCount);
|
||||
memcpy(_stateCacheCopy, _stateCache, sizeof(_stateCacheCopy));
|
||||
memcpy(_disassemblyCacheCopy, _disassemblyCache, sizeof(_disassemblyCacheCopy));
|
||||
startPos = _currentPos + ExecutionLogSize - lineCount;
|
||||
startPos = (_currentPos > 0 ? _currentPos : TraceLogger::ExecutionLogSize) - 1;
|
||||
}
|
||||
|
||||
bool enabled = false;
|
||||
|
@ -401,8 +401,11 @@ const char* TraceLogger::GetExecutionTrace(uint32_t lineCount)
|
|||
}
|
||||
|
||||
if(enabled) {
|
||||
for(int i = 0; i < (int)lineCount; i++) {
|
||||
int index = (startPos + i) % ExecutionLogSize;
|
||||
for(int i = 0; i < TraceLogger::ExecutionLogSize; i++) {
|
||||
int index = (startPos - i);
|
||||
if(index < 0) {
|
||||
index = TraceLogger::ExecutionLogSize + index;
|
||||
}
|
||||
|
||||
if((i > 0 && startPos == index) || !_disassemblyCacheCopy[index].IsInitialized()) {
|
||||
//If the entire array was checked, or this element is not initialized, stop
|
||||
|
@ -411,9 +414,7 @@ const char* TraceLogger::GetExecutionTrace(uint32_t lineCount)
|
|||
|
||||
CpuType cpuType = _disassemblyCacheCopy[index].GetCpuType();
|
||||
if(!_logCpu[(int)cpuType]) {
|
||||
//This line isn't for a CPU currently being logged, increase the line count to try and
|
||||
//get the number of lines the UI requested for the CPU type currently being logged
|
||||
lineCount++;
|
||||
//This line isn't for a CPU currently being logged
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -426,6 +427,11 @@ const char* TraceLogger::GetExecutionTrace(uint32_t lineCount)
|
|||
_disassemblyCacheCopy[index].GetByteCode(byteCode);
|
||||
_executionTrace += byteCode + "\x1";
|
||||
GetTraceRow(_executionTrace, _disassemblyCacheCopy[index], _stateCacheCopy[index]);
|
||||
|
||||
lineCount--;
|
||||
if(lineCount == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _executionTrace.c_str();
|
||||
|
|
|
@ -62,6 +62,11 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
set
|
||||
{
|
||||
this._dataProvider = value;
|
||||
|
||||
int lineCount = this._dataProvider.GetLineCount();
|
||||
if(this.SelectedLine >= lineCount) {
|
||||
this.SelectedLine = lineCount - 1;
|
||||
}
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
|
2
UI/Debugger/frmTraceLogger.Designer.cs
generated
2
UI/Debugger/frmTraceLogger.Designer.cs
generated
|
@ -475,6 +475,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.chkIndentCode.TabIndex = 8;
|
||||
this.chkIndentCode.Text = "Indent code based on stack pointer";
|
||||
this.chkIndentCode.UseVisualStyleBackColor = true;
|
||||
this.chkIndentCode.Visible = false;
|
||||
this.chkIndentCode.CheckedChanged += new System.EventHandler(this.chkOptions_CheckedChanged);
|
||||
//
|
||||
// chkUseLabels
|
||||
|
@ -533,6 +534,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.chkExtendZeroPage.TabIndex = 20;
|
||||
this.chkExtendZeroPage.Text = "Show zero page addresses as 2 bytes";
|
||||
this.chkExtendZeroPage.UseVisualStyleBackColor = true;
|
||||
this.chkExtendZeroPage.Visible = false;
|
||||
this.chkExtendZeroPage.CheckedChanged += new System.EventHandler(this.chkOptions_CheckedChanged);
|
||||
//
|
||||
// chkLogCpu
|
||||
|
|
|
@ -378,7 +378,7 @@ namespace Mesen.GUI.Debugger
|
|||
{
|
||||
_lineCount = count;
|
||||
UpdateMenu();
|
||||
RefreshLog(false, true);
|
||||
RefreshLog(true, true);
|
||||
}
|
||||
|
||||
private void mnu30000Lines_Click(object sender, EventArgs e)
|
||||
|
@ -499,10 +499,11 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
public CodeLineData GetCodeLineData(int lineIndex)
|
||||
{
|
||||
int count = _textLines.Count - 1;
|
||||
return new CodeLineData() {
|
||||
Address = _addresses[lineIndex],
|
||||
Text = _textLines[lineIndex],
|
||||
ByteCode = _byteCode[lineIndex],
|
||||
Address = _addresses[count - lineIndex],
|
||||
Text = _textLines[count - lineIndex],
|
||||
ByteCode = _byteCode[count - lineIndex],
|
||||
EffectiveAddress = -1
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue