GCC: Fixed freeze when compiling TraceLogger.cpp

This commit is contained in:
Sour 2019-07-18 17:24:32 -04:00
parent f720c39215
commit d4b2245ff8
2 changed files with 12 additions and 7 deletions

View file

@ -22,6 +22,11 @@ TraceLogger::TraceLogger(Debugger* debugger, shared_ptr<Console> console)
_logCount = 0;
_logToFile = false;
_pendingLog = false;
_stateCache = new DebugState[TraceLogger::ExecutionLogSize];
_stateCacheCopy = new DebugState[TraceLogger::ExecutionLogSize];
_disassemblyCache = new DisassemblyInfo[TraceLogger::ExecutionLogSize];
_disassemblyCacheCopy = new DisassemblyInfo[TraceLogger::ExecutionLogSize];
}
TraceLogger::~TraceLogger()
@ -458,8 +463,8 @@ const char* TraceLogger::GetExecutionTrace(uint32_t lineCount)
{
auto lock = _lock.AcquireSafe();
lineCount = std::min(lineCount, _logCount);
memcpy(_stateCacheCopy, _stateCache, sizeof(_stateCacheCopy));
memcpy(_disassemblyCacheCopy, _disassemblyCache, sizeof(_disassemblyCacheCopy));
memcpy(_stateCacheCopy, _stateCache, sizeof(DebugState) * TraceLogger::ExecutionLogSize);
memcpy(_disassemblyCacheCopy, _disassemblyCache, sizeof(DisassemblyInfo) * TraceLogger::ExecutionLogSize);
startPos = (_currentPos > 0 ? _currentPos : TraceLogger::ExecutionLogSize) - 1;
}

View file

@ -62,7 +62,7 @@ struct RowPart
class TraceLogger
{
private:
static constexpr int ExecutionLogSize = 60000;
static constexpr int ExecutionLogSize = 30000;
//Must be static to be thread-safe when switching game
static string _executionTrace;
@ -87,11 +87,11 @@ private:
bool _logToFile;
uint32_t _currentPos;
uint32_t _logCount;
DebugState _stateCache[ExecutionLogSize] = {};
DisassemblyInfo _disassemblyCache[ExecutionLogSize];
DebugState *_stateCache = nullptr;
DisassemblyInfo *_disassemblyCache = nullptr;
DebugState _stateCacheCopy[ExecutionLogSize] = {};
DisassemblyInfo _disassemblyCacheCopy[ExecutionLogSize];
DebugState *_stateCacheCopy = nullptr;
DisassemblyInfo *_disassemblyCacheCopy = nullptr;
SimpleLock _lock;