Merge pull request #6014 from unknownbrackets/debugger

Skip an error, add memchecks, upgrade old symbol maps
This commit is contained in:
Henrik Rydgård 2014-05-04 11:19:14 +02:00
commit 48add13a59
5 changed files with 40 additions and 20 deletions

View File

@ -287,44 +287,38 @@ bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask)
u32 functionAddress = INVALID_ADDRESS;
u32 dataAddress = INVALID_ADDRESS;
if (symmask & ST_FUNCTION)
if (symmask & ST_FUNCTION) {
functionAddress = GetFunctionStart(address);
if (symmask & ST_DATA)
dataAddress = GetDataStart(address);
if (functionAddress == INVALID_ADDRESS || dataAddress == INVALID_ADDRESS) {
// If both are found, we always return the function, so just do that early.
if (functionAddress != INVALID_ADDRESS) {
if (info != NULL) {
info->type = ST_FUNCTION;
info->address = functionAddress;
info->size = GetFunctionSize(functionAddress);
info->moduleAddress = GetFunctionModuleAddress(functionAddress);
}
return true;
}
}
if (symmask & ST_DATA) {
dataAddress = GetDataStart(address);
if (dataAddress != INVALID_ADDRESS) {
if (info != NULL) {
info->type = ST_DATA;
info->address = dataAddress;
info->size = GetDataSize(dataAddress);
info->moduleAddress = GetDataModuleAddress(dataAddress);
}
return true;
}
return false;
}
// if both exist, return the function
if (info != NULL) {
info->type = ST_FUNCTION;
info->address = functionAddress;
info->size = GetFunctionSize(functionAddress);
}
return true;
return false;
}
u32 SymbolMap::GetNextSymbolAddress(u32 address, SymbolType symmask) {
@ -588,6 +582,15 @@ u32 SymbolMap::GetFunctionSize(u32 startAddress) const {
return it->second.size;
}
u32 SymbolMap::GetFunctionModuleAddress(u32 startAddress) const {
lock_guard guard(lock_);
auto it = activeFunctions.find(startAddress);
if (it == activeFunctions.end())
return INVALID_ADDRESS;
return GetModuleAbsoluteAddr(0, it->second.module);
}
int SymbolMap::GetFunctionNum(u32 address) const {
lock_guard guard(lock_);
u32 start = GetFunctionStart(address);
@ -904,6 +907,14 @@ u32 SymbolMap::GetDataSize(u32 startAddress) const {
return it->second.size;
}
u32 SymbolMap::GetDataModuleAddress(u32 startAddress) const {
lock_guard guard(lock_);
auto it = activeData.find(startAddress);
if (it == activeData.end())
return INVALID_ADDRESS;
return GetModuleAbsoluteAddr(0, it->second.module);
}
DataType SymbolMap::GetDataType(u32 startAddress) const {
lock_guard guard(lock_);
auto it = activeData.find(startAddress);

View File

@ -37,6 +37,7 @@ struct SymbolInfo {
SymbolType type;
u32 address;
u32 size;
u32 moduleAddress;
};
struct SymbolEntry {
@ -93,6 +94,7 @@ public:
u32 GetFunctionStart(u32 address) const;
int GetFunctionNum(u32 address) const;
u32 GetFunctionSize(u32 startAddress) const;
u32 GetFunctionModuleAddress(u32 startAddress) const;
bool SetFunctionSize(u32 startAddress, u32 newSize);
bool RemoveFunction(u32 startAddress, bool removeName);
// Search for the first address their may be a function after address.
@ -107,6 +109,7 @@ public:
void AddData(u32 address, u32 size, DataType type, int moduleIndex = -1);
u32 GetDataStart(u32 address) const;
u32 GetDataSize(u32 startAddress) const;
u32 GetDataModuleAddress(u32 startAddress) const;
DataType GetDataType(u32 startAddress) const;
static const u32 INVALID_ADDRESS = (u32)-1;

View File

@ -17,10 +17,11 @@
#include "Core/MemMap.h"
#include "Core/Reporting.h"
#include "../MIPS/MIPSTables.h"
#include "Core/MIPS/MIPSTables.h"
#include "ElfReader.h"
#include "../Debugger/SymbolMap.h"
#include "../HLE/sceKernelMemory.h"
#include "Core/Debugger/Breakpoints.h"
#include "Core/Debugger/SymbolMap.h"
#include "Core/HLE/sceKernelMemory.h"
const char *ElfReader::GetSectionName(int section)
@ -442,6 +443,7 @@ int ElfReader::LoadInto(u32 loadAddress)
}
memcpy(dst, src, srcSize);
CBreakPoints::ExecMemCheck(writeAddr, true, dstSize, currentMIPS->pc);
DEBUG_LOG(LOADER,"Loadable Segment Copied to %08x, size %08x", writeAddr, (u32)p->p_memsz);
}
}

View File

@ -447,7 +447,10 @@ void JitBlockCache::DestroyBlock(int block_num, bool invalidate) {
if (b->proxyFor) {
for (size_t i = 0; i < b->proxyFor->size(); i++) {
int proxied_blocknum = GetBlockNumberFromStartAddress((*b->proxyFor)[i], false);
DestroyBlock(proxied_blocknum, invalidate);
// If it was already cleared, we don't know which to destroy.
if (proxied_blocknum != -1) {
DestroyBlock(proxied_blocknum, invalidate);
}
}
b->proxyFor->clear();
delete b->proxyFor;

View File

@ -751,7 +751,8 @@ skip:
// We still need to insert the func for hashing purposes.
currentFunction.start = syminfo.address;
currentFunction.end = syminfo.address + syminfo.size - 4;
currentFunction.foundInSymbolMap = true;
// Re-add it to the map if the module address is not known yet (only happens from loaded maps.)
currentFunction.foundInSymbolMap = syminfo.moduleAddress != 0;
functions.push_back(currentFunction);
currentFunction.foundInSymbolMap = false;
currentFunction.start = addr + 4;