mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-13 06:20:26 +02:00
Avoid returning points from the symbol map.
Now that it uses a lookup, this is even more dangerous. But, the maps could be reordered while it's trying to print the pointer and cause that data to become invalid. This should be safe from race conditions.
This commit is contained in:
1 parent
b1af4f4911
commit
76afb2a8d5
11 files changed
+69
-50
No files matched your search
@@ -15,7 +15,7 @@
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
@@ -70,10 +70,10 @@ void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertS
|
||||
u32 branchTarget;
|
||||
sscanf(disasm+3,"%08x",&branchTarget);
|
||||
|
||||
const char* addressSymbol = symbolMap.GetLabelName(branchTarget);
|
||||
if (addressSymbol != NULL && insertSymbols)
|
||||
const std::string addressSymbol = symbolMap.GetLabelString(branchTarget);
|
||||
if (!addressSymbol.empty() && insertSymbols)
|
||||
{
|
||||
arguments += sprintf(arguments,"%s",addressSymbol);
|
||||
arguments += sprintf(arguments,"%s",addressSymbol.c_str());
|
||||
} else {
|
||||
arguments += sprintf(arguments,"0x%08X",branchTarget);
|
||||
}
|
||||
@@ -740,16 +740,16 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool
|
||||
dest.type = DISTYPE_MACRO;
|
||||
dest.info = MIPSAnalyst::GetOpcodeInfo(DisassemblyManager::getCpu(),address);
|
||||
|
||||
const char* addressSymbol;
|
||||
std::string addressSymbol;
|
||||
switch (type)
|
||||
{
|
||||
case MACRO_LI:
|
||||
dest.name = name;
|
||||
|
||||
addressSymbol = symbolMap.GetLabelName(immediate);
|
||||
if (addressSymbol != NULL && insertSymbols)
|
||||
addressSymbol = symbolMap.GetLabelString(immediate);
|
||||
if (!addressSymbol.empty() && insertSymbols)
|
||||
{
|
||||
sprintf(buffer,"%s,%s",DisassemblyManager::getCpu()->GetRegName(0,rt),addressSymbol);
|
||||
sprintf(buffer,"%s,%s",DisassemblyManager::getCpu()->GetRegName(0,rt),addressSymbol.c_str());
|
||||
} else {
|
||||
sprintf(buffer,"%s,0x%08X",DisassemblyManager::getCpu()->GetRegName(0,rt),immediate);
|
||||
}
|
||||
@@ -762,10 +762,10 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool
|
||||
case MACRO_MEMORYIMM:
|
||||
dest.name = name;
|
||||
|
||||
addressSymbol = symbolMap.GetLabelName(immediate);
|
||||
if (addressSymbol != NULL && insertSymbols)
|
||||
addressSymbol = symbolMap.GetLabelString(immediate);
|
||||
if (!addressSymbol.empty() && insertSymbols)
|
||||
{
|
||||
sprintf(buffer,"%s,%s",DisassemblyManager::getCpu()->GetRegName(0,rt),addressSymbol);
|
||||
sprintf(buffer,"%s,%s",DisassemblyManager::getCpu()->GetRegName(0,rt),addressSymbol.c_str());
|
||||
} else {
|
||||
sprintf(buffer,"%s,0x%08X",DisassemblyManager::getCpu()->GetRegName(0,rt),immediate);
|
||||
}
|
||||
@@ -956,9 +956,9 @@ void DisassemblyData::createLines()
|
||||
case DATATYPE_WORD:
|
||||
{
|
||||
value = Memory::Read_U32(pos);
|
||||
const char* label = symbolMap.GetLabelName(value);
|
||||
if (label != NULL)
|
||||
sprintf(buffer,"%s",label);
|
||||
const std::string label = symbolMap.GetLabelString(value);
|
||||
if (!label.empty())
|
||||
sprintf(buffer,"%s",label.c_str());
|
||||
else
|
||||
sprintf(buffer,"0x%08X",value);
|
||||
pos += 4;
|
||||
|
||||
Reference in new issue
Block a user