make all disassembler calls threadsafe .. hopefully.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1462 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
6bf333c893
commit
d01e05b7b5
|
@ -1247,61 +1247,61 @@ namespace PPCDisasm
|
|||
|
||||
case 19:
|
||||
switch (PPCGETIDX2(in)) {
|
||||
case 0:
|
||||
mcrf(dp,in,'\0'); /* mcrf */
|
||||
break;
|
||||
case 0:
|
||||
mcrf(dp,in,'\0'); /* mcrf */
|
||||
break;
|
||||
|
||||
case 16:
|
||||
branch(dp,in,"lr",0,0); /* bclr */
|
||||
break;
|
||||
case 16:
|
||||
branch(dp,in,"lr",0,0); /* bclr */
|
||||
break;
|
||||
|
||||
case 33:
|
||||
crop(dp,in,"nor","not"); /* crnor */
|
||||
break;
|
||||
case 33:
|
||||
crop(dp,in,"nor","not"); /* crnor */
|
||||
break;
|
||||
|
||||
case 50:
|
||||
nooper(dp,in,"rfi",PPCF_SUPER);
|
||||
break;
|
||||
case 50:
|
||||
nooper(dp,in,"rfi",PPCF_SUPER);
|
||||
break;
|
||||
|
||||
case 129:
|
||||
crop(dp,in,"andc",NULL); /* crandc */
|
||||
break;
|
||||
case 129:
|
||||
crop(dp,in,"andc",NULL); /* crandc */
|
||||
break;
|
||||
|
||||
case 150:
|
||||
nooper(dp,in,"isync",0);
|
||||
break;
|
||||
case 150:
|
||||
nooper(dp,in,"isync",0);
|
||||
break;
|
||||
|
||||
case 193:
|
||||
crop(dp,in,"xor","clr"); /* crxor */
|
||||
break;
|
||||
case 193:
|
||||
crop(dp,in,"xor","clr"); /* crxor */
|
||||
break;
|
||||
|
||||
case 225:
|
||||
crop(dp,in,"nand",NULL); /* crnand */
|
||||
break;
|
||||
case 225:
|
||||
crop(dp,in,"nand",NULL); /* crnand */
|
||||
break;
|
||||
|
||||
case 257:
|
||||
crop(dp,in,"and",NULL); /* crand */
|
||||
break;
|
||||
case 257:
|
||||
crop(dp,in,"and",NULL); /* crand */
|
||||
break;
|
||||
|
||||
case 289:
|
||||
crop(dp,in,"eqv","set"); /* creqv */
|
||||
break;
|
||||
case 289:
|
||||
crop(dp,in,"eqv","set"); /* creqv */
|
||||
break;
|
||||
|
||||
case 417:
|
||||
crop(dp,in,"orc",NULL); /* crorc */
|
||||
break;
|
||||
case 417:
|
||||
crop(dp,in,"orc",NULL); /* crorc */
|
||||
break;
|
||||
|
||||
case 449:
|
||||
crop(dp,in,"or","move"); /* cror */
|
||||
break;
|
||||
case 449:
|
||||
crop(dp,in,"or","move"); /* cror */
|
||||
break;
|
||||
|
||||
case 528:
|
||||
branch(dp,in,"ctr",0,0); /* bcctr */
|
||||
break;
|
||||
case 528:
|
||||
branch(dp,in,"ctr",0,0); /* bcctr */
|
||||
break;
|
||||
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1346,24 +1346,24 @@ namespace PPCDisasm
|
|||
|
||||
case 30:
|
||||
switch (in & 0x1c) {
|
||||
case 0:
|
||||
rld(dp,in,"icl",0); /* rldicl */
|
||||
break;
|
||||
case 1:
|
||||
rld(dp,in,"icr",0); /* rldicr */
|
||||
break;
|
||||
case 2:
|
||||
rld(dp,in,"ic",0); /* rldic */
|
||||
break;
|
||||
case 3:
|
||||
rld(dp,in,"imi",0); /* rldimi */
|
||||
break;
|
||||
case 4:
|
||||
rld(dp,in,in&2?"cl":"cr",1); /* rldcl, rldcr */
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
case 0:
|
||||
rld(dp,in,"icl",0); /* rldicl */
|
||||
break;
|
||||
case 1:
|
||||
rld(dp,in,"icr",0); /* rldicr */
|
||||
break;
|
||||
case 2:
|
||||
rld(dp,in,"ic",0); /* rldic */
|
||||
break;
|
||||
case 3:
|
||||
rld(dp,in,"imi",0); /* rldimi */
|
||||
break;
|
||||
case 4:
|
||||
rld(dp,in,in&2?"cl":"cr",1); /* rldcl, rldcr */
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1970,228 +1970,228 @@ namespace PPCDisasm
|
|||
|
||||
case 58:
|
||||
switch (in & 3) {
|
||||
case 0:
|
||||
ldst(dp,in&~3,"ld",'r',PPCF_64);
|
||||
break;
|
||||
case 1:
|
||||
ldst(dp,in&~3,"ldu",'r',PPCF_64);
|
||||
break;
|
||||
case 2:
|
||||
ldst(dp,in&~3,"lwa",'r',PPCF_64);
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
case 0:
|
||||
ldst(dp,in&~3,"ld",'r',PPCF_64);
|
||||
break;
|
||||
case 1:
|
||||
ldst(dp,in&~3,"ldu",'r',PPCF_64);
|
||||
break;
|
||||
case 2:
|
||||
ldst(dp,in&~3,"lwa",'r',PPCF_64);
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 59:
|
||||
switch (in & 0x3e) {
|
||||
case 36:
|
||||
fdabc(dp,in,"divs",6,0);
|
||||
break;
|
||||
case 36:
|
||||
fdabc(dp,in,"divs",6,0);
|
||||
break;
|
||||
|
||||
case 40:
|
||||
fdabc(dp,in,"subs",6,0);
|
||||
break;
|
||||
case 40:
|
||||
fdabc(dp,in,"subs",6,0);
|
||||
break;
|
||||
|
||||
case 42:
|
||||
fdabc(dp,in,"adds",6,0);
|
||||
break;
|
||||
case 42:
|
||||
fdabc(dp,in,"adds",6,0);
|
||||
break;
|
||||
|
||||
case 44:
|
||||
fdabc(dp,in,"sqrts",2,0);
|
||||
break;
|
||||
case 44:
|
||||
fdabc(dp,in,"sqrts",2,0);
|
||||
break;
|
||||
|
||||
case 48:
|
||||
fdabc(dp,in,"res",2,0);
|
||||
break;
|
||||
case 48:
|
||||
fdabc(dp,in,"res",2,0);
|
||||
break;
|
||||
|
||||
case 50:
|
||||
fdabc(dp,in,"muls",5,0);
|
||||
break;
|
||||
case 50:
|
||||
fdabc(dp,in,"muls",5,0);
|
||||
break;
|
||||
|
||||
case 56:
|
||||
fdabc(dp,in,"msubs",7,0);
|
||||
break;
|
||||
case 56:
|
||||
fdabc(dp,in,"msubs",7,0);
|
||||
break;
|
||||
|
||||
case 58:
|
||||
fdabc(dp,in,"madds",7,0);
|
||||
break;
|
||||
case 58:
|
||||
fdabc(dp,in,"madds",7,0);
|
||||
break;
|
||||
|
||||
case 60:
|
||||
fdabc(dp,in,"nmsubs",7,0);
|
||||
break;
|
||||
case 60:
|
||||
fdabc(dp,in,"nmsubs",7,0);
|
||||
break;
|
||||
|
||||
case 62:
|
||||
fdabc(dp,in,"nmadds",7,0);
|
||||
break;
|
||||
case 62:
|
||||
fdabc(dp,in,"nmadds",7,0);
|
||||
break;
|
||||
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 62:
|
||||
switch (in & 3) {
|
||||
case 0:
|
||||
ldst(dp,in&~3,"std",'r',PPCF_64);
|
||||
break;
|
||||
case 1:
|
||||
ldst(dp,in&~3,"stdu",'r',PPCF_64);
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
case 0:
|
||||
ldst(dp,in&~3,"std",'r',PPCF_64);
|
||||
break;
|
||||
case 1:
|
||||
ldst(dp,in&~3,"stdu",'r',PPCF_64);
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 63:
|
||||
if (in & 32) {
|
||||
switch (in & 0x1e) {
|
||||
case 4:
|
||||
fdabc(dp,in,"div",6,0);
|
||||
break;
|
||||
case 4:
|
||||
fdabc(dp,in,"div",6,0);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
fdabc(dp,in,"sub",6,0);
|
||||
break;
|
||||
case 8:
|
||||
fdabc(dp,in,"sub",6,0);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
fdabc(dp,in,"add",6,0);
|
||||
break;
|
||||
case 10:
|
||||
fdabc(dp,in,"add",6,0);
|
||||
break;
|
||||
|
||||
case 12:
|
||||
fdabc(dp,in,"sqrt",2,0);
|
||||
break;
|
||||
case 12:
|
||||
fdabc(dp,in,"sqrt",2,0);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
fdabc(dp,in,"sel",7,0);
|
||||
break;
|
||||
case 14:
|
||||
fdabc(dp,in,"sel",7,0);
|
||||
break;
|
||||
|
||||
case 18:
|
||||
fdabc(dp,in,"mul",5,0);
|
||||
break;
|
||||
case 18:
|
||||
fdabc(dp,in,"mul",5,0);
|
||||
break;
|
||||
|
||||
case 20:
|
||||
fdabc(dp,in,"rsqrte",2,0);
|
||||
break;
|
||||
case 20:
|
||||
fdabc(dp,in,"rsqrte",2,0);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
fdabc(dp,in,"msub",7,0);
|
||||
break;
|
||||
case 24:
|
||||
fdabc(dp,in,"msub",7,0);
|
||||
break;
|
||||
|
||||
case 26:
|
||||
fdabc(dp,in,"madd",7,0);
|
||||
break;
|
||||
case 26:
|
||||
fdabc(dp,in,"madd",7,0);
|
||||
break;
|
||||
|
||||
case 28:
|
||||
fdabc(dp,in,"nmsub",7,0);
|
||||
break;
|
||||
case 28:
|
||||
fdabc(dp,in,"nmsub",7,0);
|
||||
break;
|
||||
|
||||
case 30:
|
||||
fdabc(dp,in,"nmadd",7,0);
|
||||
break;
|
||||
case 30:
|
||||
fdabc(dp,in,"nmadd",7,0);
|
||||
break;
|
||||
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
switch (PPCGETIDX2(in)) {
|
||||
case 0:
|
||||
fcmp(dp,in,'u');
|
||||
break;
|
||||
case 0:
|
||||
fcmp(dp,in,'u');
|
||||
break;
|
||||
|
||||
case 12:
|
||||
fdabc(dp,in,"rsp",10,0);
|
||||
break;
|
||||
case 12:
|
||||
fdabc(dp,in,"rsp",10,0);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
fdabc(dp,in,"ctiw",10,0);
|
||||
break;
|
||||
case 14:
|
||||
fdabc(dp,in,"ctiw",10,0);
|
||||
break;
|
||||
|
||||
case 15:
|
||||
fdabc(dp,in,"ctiwz",10,0);
|
||||
break;
|
||||
case 15:
|
||||
fdabc(dp,in,"ctiwz",10,0);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
fcmp(dp,in,'o');
|
||||
break;
|
||||
case 32:
|
||||
fcmp(dp,in,'o');
|
||||
break;
|
||||
|
||||
case 38:
|
||||
mtfsb(dp,in,1);
|
||||
break;
|
||||
case 38:
|
||||
mtfsb(dp,in,1);
|
||||
break;
|
||||
|
||||
case 40:
|
||||
fdabc(dp,in,"neg",10,0);
|
||||
break;
|
||||
case 40:
|
||||
fdabc(dp,in,"neg",10,0);
|
||||
break;
|
||||
|
||||
case 64:
|
||||
mcrf(dp,in,'s'); /* mcrfs */
|
||||
break;
|
||||
case 64:
|
||||
mcrf(dp,in,'s'); /* mcrfs */
|
||||
break;
|
||||
|
||||
case 70:
|
||||
mtfsb(dp,in,0);
|
||||
break;
|
||||
case 70:
|
||||
mtfsb(dp,in,0);
|
||||
break;
|
||||
|
||||
case 72:
|
||||
fdabc(dp,in,"mr",10,0);
|
||||
break;
|
||||
case 72:
|
||||
fdabc(dp,in,"mr",10,0);
|
||||
break;
|
||||
|
||||
case 134:
|
||||
if (!(in & 0x006f0800)) {
|
||||
sprintf(dp->opcode,"mtfsfi%s",rcsel[in&1]);
|
||||
sprintf(dp->operands,"cr%d,%d",(int)PPCGETCRD(in),
|
||||
(int)(in & 0xf000)>>12);
|
||||
}
|
||||
else
|
||||
ill(dp,in);
|
||||
break;
|
||||
case 134:
|
||||
if (!(in & 0x006f0800)) {
|
||||
sprintf(dp->opcode,"mtfsfi%s",rcsel[in&1]);
|
||||
sprintf(dp->operands,"cr%d,%d",(int)PPCGETCRD(in),
|
||||
(int)(in & 0xf000)>>12);
|
||||
}
|
||||
else
|
||||
ill(dp,in);
|
||||
break;
|
||||
|
||||
case 136:
|
||||
fdabc(dp,in,"nabs",10,0);
|
||||
break;
|
||||
case 136:
|
||||
fdabc(dp,in,"nabs",10,0);
|
||||
break;
|
||||
|
||||
case 264:
|
||||
fdabc(dp,in,"abs",10,0);
|
||||
break;
|
||||
case 264:
|
||||
fdabc(dp,in,"abs",10,0);
|
||||
break;
|
||||
|
||||
case 583:
|
||||
if (in & (PPCAMASK|PPCBMASK))
|
||||
ill(dp,in);
|
||||
else
|
||||
dab(dp,in,"mffs",4,0,0,-1,0);
|
||||
break;
|
||||
case 583:
|
||||
if (in & (PPCAMASK|PPCBMASK))
|
||||
ill(dp,in);
|
||||
else
|
||||
dab(dp,in,"mffs",4,0,0,-1,0);
|
||||
break;
|
||||
|
||||
case 711:
|
||||
if (!(in & 0x02010000)) {
|
||||
sprintf(dp->opcode,"mtfsf%s",rcsel[in&1]);
|
||||
sprintf(dp->operands,"0x%x,%d",
|
||||
(unsigned)(in & 0x01fe)>>17,(int)PPCGETB(in));
|
||||
}
|
||||
else
|
||||
ill(dp,in);
|
||||
break;
|
||||
case 711:
|
||||
if (!(in & 0x02010000)) {
|
||||
sprintf(dp->opcode,"mtfsf%s",rcsel[in&1]);
|
||||
sprintf(dp->operands,"0x%x,%d",
|
||||
(unsigned)(in & 0x01fe)>>17,(int)PPCGETB(in));
|
||||
}
|
||||
else
|
||||
ill(dp,in);
|
||||
break;
|
||||
|
||||
case 814:
|
||||
fdabc(dp,in,"fctid",10,PPCF_64);
|
||||
break;
|
||||
case 814:
|
||||
fdabc(dp,in,"fctid",10,PPCF_64);
|
||||
break;
|
||||
|
||||
case 815:
|
||||
fdabc(dp,in,"fctidz",10,PPCF_64);
|
||||
break;
|
||||
case 815:
|
||||
fdabc(dp,in,"fctidz",10,PPCF_64);
|
||||
break;
|
||||
|
||||
case 846:
|
||||
fdabc(dp,in,"fcfid",10,PPCF_64);
|
||||
break;
|
||||
case 846:
|
||||
fdabc(dp,in,"fcfid",10,PPCF_64);
|
||||
break;
|
||||
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
default:
|
||||
ill(dp,in);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2204,16 +2204,17 @@ namespace PPCDisasm
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// What were MS thinking?
|
||||
#ifdef _WIN32
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
// simplified interface
|
||||
|
||||
const char *DisassembleGekko(unsigned int opcode, unsigned int curInstAddr)
|
||||
void DisassembleGekko(unsigned int opcode, unsigned int curInstAddr, char *dest, int max_size)
|
||||
{
|
||||
char opcodeStr[64], operandStr[64];
|
||||
PPCDisasm::DisasmPara_PPC dp;
|
||||
static char buf[128];
|
||||
static unsigned int opc, adr;
|
||||
unsigned int opc, adr;
|
||||
|
||||
opc = opcode;
|
||||
adr = curInstAddr;
|
||||
|
@ -2225,9 +2226,7 @@ const char *DisassembleGekko(unsigned int opcode, unsigned int curInstAddr)
|
|||
|
||||
PPCDisasm::PPC_Disassemble(&dp);
|
||||
|
||||
//sprintf(buf, "%-10s %s", opcodeStr, operandStr);
|
||||
sprintf(buf, "%s\t%s", opcodeStr, operandStr);
|
||||
return buf;
|
||||
snprintf(dest, max_size, "%s\t%s", opcodeStr, operandStr);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef _POWERPC_DISASM
|
||||
#define _POWERPC_DISASM
|
||||
|
||||
const char *DisassembleGekko(unsigned int opcode, unsigned int curInstAddr);
|
||||
void DisassembleGekko(unsigned int opcode, unsigned int curInstAddr, char *dest, int max_size);
|
||||
const char *GetGRPName(unsigned int index);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#ifdef _WIN32
|
||||
#define strcasecmp _stricmp
|
||||
#define unlink _unlink
|
||||
#define snprintf _snprintf
|
||||
#else
|
||||
#define _stricmp strcasecmp
|
||||
#define _unlink unlink
|
||||
|
|
|
@ -125,9 +125,11 @@ void Console_Submit(const char *cmd)
|
|||
u32 end;
|
||||
TCHAR temp[256];
|
||||
sscanf(cmd, "%s %08x %08x", temp, &start, &end);
|
||||
char disasm[256];
|
||||
for (u32 addr = start; addr <= end; addr += 4) {
|
||||
u32 data = Memory::ReadUnchecked_U32(addr);
|
||||
printf("%08x: %08x: %s\n", addr, data, DisassembleGekko(data, addr));
|
||||
DisassembleGekko(data, addr, disasm, 256);
|
||||
printf("%08x: %08x: %s\n", addr, data, disasm);
|
||||
}
|
||||
}
|
||||
CASE("help")
|
||||
|
|
|
@ -8,8 +8,8 @@ class DebugInterface
|
|||
protected:
|
||||
virtual ~DebugInterface() {}
|
||||
public:
|
||||
virtual const char *disasm(unsigned int /*address*/) {return "NODEBUGGER";}
|
||||
virtual const char *getRawMemoryString(unsigned int /*address*/){return "NODEBUGGER";}
|
||||
virtual void disasm(unsigned int /*address*/, char *dest, int max_size) {strcpy(dest, "NODEBUGGER");}
|
||||
virtual void getRawMemoryString(unsigned int /*address*/, char *dest, int max_size) {strcpy(dest, "NODEBUGGER");}
|
||||
virtual int getInstructionSize(int /*instruction*/) {return 1;}
|
||||
|
||||
virtual bool isAlive() {return true;}
|
||||
|
|
|
@ -26,39 +26,43 @@
|
|||
#include "../PowerPC/SymbolDB.h"
|
||||
|
||||
// Not thread safe.
|
||||
const char *PPCDebugInterface::disasm(unsigned int address)
|
||||
void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
if (Memory::IsRAMAddress(address))
|
||||
{
|
||||
u32 op = Memory::Read_Instruction(address);
|
||||
return DisassembleGekko(op, address);
|
||||
DisassembleGekko(op, address, dest, max_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(dest, "No RAM here - invalid");
|
||||
}
|
||||
return "No RAM here - invalid";
|
||||
}
|
||||
|
||||
static const char tmp[] = "<unknown>";
|
||||
return tmp;
|
||||
else
|
||||
{
|
||||
strcpy(dest, "<unknown>");
|
||||
}
|
||||
}
|
||||
|
||||
const char *PPCDebugInterface::getRawMemoryString(unsigned int address)
|
||||
void PPCDebugInterface::getRawMemoryString(unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
if (address < 0xE0000000)
|
||||
{
|
||||
static char str[256] ={0};
|
||||
if (sprintf(str,"%08X",readMemory(address))!=8) {
|
||||
PanicAlert("getRawMemoryString -> WTF! ( as read somewhere;) )");
|
||||
return ":(";
|
||||
}
|
||||
return str;
|
||||
snprintf(dest, max_size, "%08X", readMemory(address));
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(dest, "--------");
|
||||
}
|
||||
return "No RAM";
|
||||
}
|
||||
static const char tmp[] = "<unknown>";
|
||||
return tmp;
|
||||
else
|
||||
{
|
||||
strcpy(dest, "<unknwn>"); // bad spelling - 8 chars
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int PPCDebugInterface::readMemory(unsigned int address)
|
||||
|
|
|
@ -11,8 +11,8 @@ class PPCDebugInterface : public DebugInterface
|
|||
{
|
||||
public:
|
||||
PPCDebugInterface(){}
|
||||
virtual const char *disasm(unsigned int address);
|
||||
virtual const char *getRawMemoryString(unsigned int address);
|
||||
virtual void disasm(unsigned int address, char *dest, int max_size);
|
||||
virtual void getRawMemoryString(unsigned int address, char *dest, int max_size);
|
||||
virtual int getInstructionSize(int instruction) {return 4;}
|
||||
virtual bool isAlive();
|
||||
virtual bool isBreakpoint(unsigned int address);
|
||||
|
|
|
@ -158,7 +158,9 @@ void Run()
|
|||
void unknown_instruction(UGeckoInstruction _inst)
|
||||
{
|
||||
CCPU::Break();
|
||||
printf("Last PC = %08x : %s\n", last_pc, DisassembleGekko(Memory::ReadUnchecked_U32(last_pc), last_pc));
|
||||
char disasm[256];
|
||||
DisassembleGekko(Memory::ReadUnchecked_U32(last_pc), last_pc, disasm, 256);
|
||||
printf("Last PC = %08x : %s\n", last_pc, disasm);
|
||||
Debugger::PrintCallstack();
|
||||
_dbg_assert_msg_(GEKKO, 0, "\nIntCPU: Unknown instr %08x at PC = %08x last_PC = %08x LR = %08x\n", _inst.hex, PC, last_pc, LR);
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ bool SymbolDB::SaveMap(const char *filename, bool WithCodes) const
|
|||
{
|
||||
// Save a map file
|
||||
const Symbol &rSymbol = itr->second;
|
||||
if(!WithCodes)
|
||||
if (!WithCodes)
|
||||
{
|
||||
fprintf(f,"%08x %08x %08x %i %s\n", rSymbol.address, rSymbol.size, rSymbol.address,
|
||||
0, rSymbol.name.c_str());
|
||||
|
@ -345,9 +345,9 @@ bool SymbolDB::SaveMap(const char *filename, bool WithCodes) const
|
|||
/* To make nice straight lines we fill out the name with spaces, we also cut off
|
||||
all names longer than 25 letters */
|
||||
std::string TempSym;
|
||||
for(u32 i = 0; i < 25; i++)
|
||||
for (u32 i = 0; i < 25; i++)
|
||||
{
|
||||
if(i < LastSymbolName.size())
|
||||
if (i < LastSymbolName.size())
|
||||
TempSym += LastSymbolName[i];
|
||||
else
|
||||
TempSym += " ";
|
||||
|
@ -355,16 +355,17 @@ bool SymbolDB::SaveMap(const char *filename, bool WithCodes) const
|
|||
|
||||
// We currently skip the last block because we don't know how long it goes
|
||||
int space;
|
||||
if(itr != functions.end())
|
||||
if (itr != functions.end())
|
||||
space = itr->second.address - LastAddress;
|
||||
else
|
||||
space = 0;
|
||||
|
||||
for(int i = 0; i < space; i+=4)
|
||||
for (int i = 0; i < space; i += 4)
|
||||
{
|
||||
int Address = LastAddress + i;
|
||||
fprintf(f,"%08x %i %20s %s\n", Address,
|
||||
0, TempSym.c_str(), debugger->disasm(Address));
|
||||
char disasm[256];
|
||||
debugger->disasm(Address, disasm, 256);
|
||||
fprintf(f,"%08x %i %20s %s\n", Address, 0, TempSym.c_str(), disasm);
|
||||
}
|
||||
fprintf(f, "\n"); // Write a blank line after each block
|
||||
}
|
||||
|
|
|
@ -176,8 +176,9 @@ void CCodeView::OnMouseUpL(wxMouseEvent& event)
|
|||
|
||||
u32 CCodeView::AddrToBranch(u32 addr)
|
||||
{
|
||||
const char *temp = debugger->disasm(addr);
|
||||
const char *mojs = strstr(temp, "->0x");
|
||||
char disasm[256];
|
||||
debugger->disasm(addr, disasm, 256);
|
||||
const char *mojs = strstr(disasm, "->0x");
|
||||
if (mojs)
|
||||
{
|
||||
u32 dest;
|
||||
|
@ -204,8 +205,12 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
|
|||
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
|
||||
break;
|
||||
|
||||
case IDM_COPYCODE:
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(debugger->disasm(selection)))); //Have to manually convert from char* to wxString, don't have to in Windows?
|
||||
case IDM_COPYCODE:
|
||||
{
|
||||
char disasm[256];
|
||||
debugger->disasm(selection, disasm, 256);
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(disasm))); //Have to manually convert from char* to wxString, don't have to in Windows?
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_COPYHEX:
|
||||
|
@ -225,7 +230,9 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
|
|||
u32 start = symbol->address;
|
||||
u32 end = start + symbol->size;
|
||||
for (u32 addr = start; addr != end; addr += 4) {
|
||||
text = text + StringFromFormat("%08x: ", addr) + debugger->disasm(addr) + "\r\n";
|
||||
char disasm[256];
|
||||
debugger->disasm(addr, disasm, 256);
|
||||
text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n";
|
||||
}
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(text.c_str())));
|
||||
}
|
||||
|
@ -423,8 +430,8 @@ void CCodeView::OnPaint(wxPaintEvent& event)
|
|||
|
||||
if (debugger->isAlive())
|
||||
{
|
||||
char dis[256] = {0};
|
||||
strcpy(dis, debugger->disasm(address));
|
||||
char dis[256];
|
||||
debugger->disasm(address, dis, 256);
|
||||
char* dis2 = strchr(dis, '\t');
|
||||
char desc[256] = "";
|
||||
|
||||
|
|
|
@ -301,25 +301,25 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
|
|||
m_RegisterWindow->Show(true);
|
||||
}
|
||||
|
||||
if(bBreakpointWindow)
|
||||
if (bBreakpointWindow)
|
||||
{
|
||||
m_BreakpointWindow = new CBreakPointWindow(this, this);
|
||||
m_BreakpointWindow->Show(true);
|
||||
}
|
||||
|
||||
if(bMemoryWindow)
|
||||
if (bMemoryWindow)
|
||||
{
|
||||
m_MemoryWindow = new CMemoryWindow(this);
|
||||
m_MemoryWindow->Show(true);
|
||||
}
|
||||
|
||||
if(bJitWindow)
|
||||
if (bJitWindow)
|
||||
{
|
||||
m_JitWindow = new CJitWindow(this);
|
||||
m_JitWindow->Show(true);
|
||||
}
|
||||
|
||||
if(bSoundWindow)
|
||||
if (bSoundWindow)
|
||||
{
|
||||
// possible todo: add some kind of if here to? can it fail?
|
||||
CPluginManager::GetInstance().OpenDebug(
|
||||
|
@ -329,7 +329,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
|
|||
);
|
||||
} // don't have any else, just ignore it
|
||||
|
||||
if(bVideoWindow)
|
||||
if (bVideoWindow)
|
||||
{
|
||||
// possible todo: add some kind of if here to? can it fail?
|
||||
CPluginManager::GetInstance().OpenDebug(
|
||||
|
|
|
@ -170,9 +170,13 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
|||
}
|
||||
break;
|
||||
|
||||
case IDM_COPYCODE:
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(debugger->disasm(selection)))); //Have to manually convert from char* to wxString, don't have to in Windows?
|
||||
case IDM_COPYCODE:
|
||||
{
|
||||
char disasm[256];
|
||||
debugger->disasm(selection, disasm, 256);
|
||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(disasm))); //Have to manually convert from char* to wxString, don't have to in Windows?
|
||||
break;
|
||||
}
|
||||
|
||||
case IDM_COPYHEX:
|
||||
{
|
||||
|
@ -303,8 +307,8 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
|
|||
dc.SetBrush(currentBrush);
|
||||
dc.SetTextForeground(_T("#600000"));
|
||||
dc.DrawText(temp, 17, rowY1);
|
||||
char mem[256] = {0};
|
||||
strcpy(mem, debugger->getRawMemoryString(address));
|
||||
char mem[256];
|
||||
debugger->getRawMemoryString(address, mem, 256);
|
||||
dc.SetTextForeground(_T("#000080"));
|
||||
dc.DrawText(wxString::FromAscii(mem), 17+fontSize*(8), rowY1);
|
||||
dc.SetTextForeground(_T("#000000"));
|
||||
|
@ -312,7 +316,7 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
|
|||
if (debugger->isAlive())
|
||||
{
|
||||
char dis[256] = {0};
|
||||
strcpy(dis, debugger->disasm(address));
|
||||
debugger->disasm(address, dis, 256);
|
||||
char* dis2 = strchr(dis, '\t');
|
||||
char desc[256] = "";
|
||||
|
||||
|
|
Loading…
Reference in New Issue