68 lines
No EOL
1.6 KiB
C++
68 lines
No EOL
1.6 KiB
C++
#pragma once
|
|
#include "stdafx.h"
|
|
#include "DebuggerTypes.h"
|
|
|
|
class DisassemblyInfo;
|
|
class MemoryManager;
|
|
class LabelManager;
|
|
|
|
enum class StatusFlagFormat
|
|
{
|
|
Hexadecimal = 0,
|
|
Text = 1,
|
|
CompactText = 2
|
|
};
|
|
|
|
struct TraceLoggerOptions
|
|
{
|
|
bool ShowByteCode;
|
|
bool ShowRegisters;
|
|
bool ShowCpuCycles;
|
|
bool ShowPpuCycles;
|
|
bool ShowPpuScanline;
|
|
bool ShowPpuFrames;
|
|
bool ShowExtraInfo;
|
|
bool IndentCode;
|
|
bool ShowEffectiveAddresses;
|
|
bool UseLabels;
|
|
StatusFlagFormat StatusFormat;
|
|
};
|
|
|
|
class TraceLogger
|
|
{
|
|
private:
|
|
static TraceLogger *_instance;
|
|
TraceLoggerOptions _options;
|
|
string _outputFilepath;
|
|
string _outputBuffer;
|
|
ofstream _outputFile;
|
|
bool _firstLine;
|
|
shared_ptr<MemoryManager> _memoryManager;
|
|
shared_ptr<LabelManager> _labelManager;
|
|
|
|
constexpr static int ExecutionLogSize = 30000;
|
|
bool _logToFile;
|
|
uint16_t _currentPos;
|
|
State _cpuStateCache[ExecutionLogSize] = {};
|
|
PPUDebugState _ppuStateCache[ExecutionLogSize] = {};
|
|
shared_ptr<DisassemblyInfo> _disassemblyCache[ExecutionLogSize] = {};
|
|
|
|
string _executionTrace;
|
|
|
|
void GetStatusFlag(string &output, uint8_t ps);
|
|
|
|
public:
|
|
TraceLogger(shared_ptr<MemoryManager> memoryManager, shared_ptr<LabelManager> labelManager);
|
|
~TraceLogger();
|
|
|
|
void Log(State &cpuState, PPUDebugState &ppuState, shared_ptr<DisassemblyInfo> disassemblyInfo);
|
|
void SetOptions(TraceLoggerOptions options);
|
|
void StartLogging(string filename);
|
|
void StopLogging();
|
|
|
|
void GetTraceRow(string &output, State &cpuState, PPUDebugState &ppuState, shared_ptr<DisassemblyInfo> &disassemblyInfo, bool firstLine);
|
|
const char* GetExecutionTrace(uint32_t lineCount);
|
|
|
|
static void LogStatic(string log);
|
|
|
|
}; |