|
|
@ -608,7 +608,7 @@ bool SHMProcess::detach()
|
|
|
|
|
|
|
|
|
|
|
|
void SHMProcess::read (uint32_t src_address, uint32_t size, uint8_t *target_buffer)
|
|
|
|
void SHMProcess::read (uint32_t src_address, uint32_t size, uint8_t *target_buffer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
// normal read under 1MB
|
|
|
|
// normal read under 1MB
|
|
|
|
if(size <= SHM_BODY)
|
|
|
|
if(size <= SHM_BODY)
|
|
|
@ -645,7 +645,7 @@ void SHMProcess::read (uint32_t src_address, uint32_t size, uint8_t *target_buff
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t SHMProcess::readByte (const uint32_t offset)
|
|
|
|
uint8_t SHMProcess::readByte (const uint32_t offset)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
gcc_barrier
|
|
|
|
gcc_barrier
|
|
|
@ -655,7 +655,7 @@ uint8_t SHMProcess::readByte (const uint32_t offset)
|
|
|
|
|
|
|
|
|
|
|
|
void SHMProcess::readByte (const uint32_t offset, uint8_t &val )
|
|
|
|
void SHMProcess::readByte (const uint32_t offset, uint8_t &val )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
gcc_barrier
|
|
|
|
gcc_barrier
|
|
|
@ -665,7 +665,7 @@ void SHMProcess::readByte (const uint32_t offset, uint8_t &val )
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t SHMProcess::readWord (const uint32_t offset)
|
|
|
|
uint16_t SHMProcess::readWord (const uint32_t offset)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
gcc_barrier
|
|
|
|
gcc_barrier
|
|
|
@ -675,7 +675,7 @@ uint16_t SHMProcess::readWord (const uint32_t offset)
|
|
|
|
|
|
|
|
|
|
|
|
void SHMProcess::readWord (const uint32_t offset, uint16_t &val)
|
|
|
|
void SHMProcess::readWord (const uint32_t offset, uint16_t &val)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
gcc_barrier
|
|
|
|
gcc_barrier
|
|
|
@ -685,7 +685,7 @@ void SHMProcess::readWord (const uint32_t offset, uint16_t &val)
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t SHMProcess::readDWord (const uint32_t offset)
|
|
|
|
uint32_t SHMProcess::readDWord (const uint32_t offset)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
gcc_barrier
|
|
|
|
gcc_barrier
|
|
|
@ -694,7 +694,7 @@ uint32_t SHMProcess::readDWord (const uint32_t offset)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void SHMProcess::readDWord (const uint32_t offset, uint32_t &val)
|
|
|
|
void SHMProcess::readDWord (const uint32_t offset, uint32_t &val)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
gcc_barrier
|
|
|
|
gcc_barrier
|
|
|
@ -708,7 +708,7 @@ void SHMProcess::readDWord (const uint32_t offset, uint32_t &val)
|
|
|
|
|
|
|
|
|
|
|
|
void SHMProcess::writeDWord (uint32_t offset, uint32_t data)
|
|
|
|
void SHMProcess::writeDWord (uint32_t offset, uint32_t data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->value = data;
|
|
|
|
D_SHMHDR->value = data;
|
|
|
@ -719,7 +719,7 @@ void SHMProcess::writeDWord (uint32_t offset, uint32_t data)
|
|
|
|
// using these is expensive.
|
|
|
|
// using these is expensive.
|
|
|
|
void SHMProcess::writeWord (uint32_t offset, uint16_t data)
|
|
|
|
void SHMProcess::writeWord (uint32_t offset, uint16_t data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->value = data;
|
|
|
|
D_SHMHDR->value = data;
|
|
|
@ -729,7 +729,7 @@ void SHMProcess::writeWord (uint32_t offset, uint16_t data)
|
|
|
|
|
|
|
|
|
|
|
|
void SHMProcess::writeByte (uint32_t offset, uint8_t data)
|
|
|
|
void SHMProcess::writeByte (uint32_t offset, uint8_t data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->value = data;
|
|
|
|
D_SHMHDR->value = data;
|
|
|
@ -739,7 +739,7 @@ void SHMProcess::writeByte (uint32_t offset, uint8_t data)
|
|
|
|
|
|
|
|
|
|
|
|
void SHMProcess::write (uint32_t dst_address, uint32_t size, uint8_t *source_buffer)
|
|
|
|
void SHMProcess::write (uint32_t dst_address, uint32_t size, uint8_t *source_buffer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
// normal write under 1MB
|
|
|
|
// normal write under 1MB
|
|
|
|
if(size <= SHM_BODY)
|
|
|
|
if(size <= SHM_BODY)
|
|
|
@ -777,7 +777,7 @@ void SHMProcess::write (uint32_t dst_address, uint32_t size, uint8_t *source_buf
|
|
|
|
// FIXME: butt-fugly
|
|
|
|
// FIXME: butt-fugly
|
|
|
|
const std::string SHMProcess::readCString (uint32_t offset)
|
|
|
|
const std::string SHMProcess::readCString (uint32_t offset)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
std::string temp;
|
|
|
|
std::string temp;
|
|
|
|
char temp_c[256];
|
|
|
|
char temp_c[256];
|
|
|
@ -796,7 +796,7 @@ const std::string SHMProcess::readCString (uint32_t offset)
|
|
|
|
|
|
|
|
|
|
|
|
const std::string SHMProcess::readSTLString(uint32_t offset)
|
|
|
|
const std::string SHMProcess::readSTLString(uint32_t offset)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
full_barrier
|
|
|
|
full_barrier
|
|
|
@ -806,7 +806,7 @@ const std::string SHMProcess::readSTLString(uint32_t offset)
|
|
|
|
|
|
|
|
|
|
|
|
size_t SHMProcess::readSTLString (uint32_t offset, char * buffer, size_t bufcapacity)
|
|
|
|
size_t SHMProcess::readSTLString (uint32_t offset, char * buffer, size_t bufcapacity)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
D_SHMHDR->address = offset;
|
|
|
|
full_barrier
|
|
|
|
full_barrier
|
|
|
@ -820,7 +820,7 @@ size_t SHMProcess::readSTLString (uint32_t offset, char * buffer, size_t bufcapa
|
|
|
|
|
|
|
|
|
|
|
|
void SHMProcess::writeSTLString(const uint32_t address, const std::string writeString)
|
|
|
|
void SHMProcess::writeSTLString(const uint32_t address, const std::string writeString)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
D_SHMHDR->address = address;
|
|
|
|
D_SHMHDR->address = address;
|
|
|
|
strncpy(D_SHMDATA(char),writeString.c_str(),writeString.length()+1); // length + 1 for the null terminator
|
|
|
|
strncpy(D_SHMDATA(char),writeString.c_str(),writeString.length()+1); // length + 1 for the null terminator
|
|
|
@ -830,7 +830,7 @@ void SHMProcess::writeSTLString(const uint32_t address, const std::string writeS
|
|
|
|
|
|
|
|
|
|
|
|
string SHMProcess::readClassName (uint32_t vptr)
|
|
|
|
string SHMProcess::readClassName (uint32_t vptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
int typeinfo = readDWord(vptr - 0x4);
|
|
|
|
int typeinfo = readDWord(vptr - 0x4);
|
|
|
|
int typestring = readDWord(typeinfo + 0x4);
|
|
|
|
int typestring = readDWord(typeinfo + 0x4);
|
|
|
@ -843,7 +843,7 @@ string SHMProcess::readClassName (uint32_t vptr)
|
|
|
|
// get module index by name and version. bool 0 = error
|
|
|
|
// get module index by name and version. bool 0 = error
|
|
|
|
bool SHMProcess::getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT)
|
|
|
|
bool SHMProcess::getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!d->locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
modulelookup * payload = D_SHMDATA(modulelookup);
|
|
|
|
modulelookup * payload = D_SHMDATA(modulelookup);
|
|
|
|
payload->version = version;
|
|
|
|
payload->version = version;
|
|
|
@ -873,7 +873,7 @@ char * SHMProcess::getSHMStart (void)
|
|
|
|
|
|
|
|
|
|
|
|
bool SHMProcess::Private::Aux_Core_Attach(bool & versionOK, pid_t & PID)
|
|
|
|
bool SHMProcess::Private::Aux_Core_Attach(bool & versionOK, pid_t & PID)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!locked) throw Error::SHMAccessDenied();
|
|
|
|
if(!locked) throw Error::MemoryAccessDenied();
|
|
|
|
|
|
|
|
|
|
|
|
SHMDATA(coreattach)->cl_affinity = OS_getAffinity();
|
|
|
|
SHMDATA(coreattach)->cl_affinity = OS_getAffinity();
|
|
|
|
if(!SetAndWait(CORE_ATTACH)) return false;
|
|
|
|
if(!SetAndWait(CORE_ATTACH)) return false;
|
|
|
|