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