require 'formula' class Visualboyadvance > 8) & 255; + b[2] = (v >> 16) & 255; + b[3] = (v >> 24) & 255; + b[4] = (v >> 32) & 255; + b[5] = (v >> 40) & 255; + b[6] = (v >> 48) & 255; + b[7] = (v >> 56) & 255; +} + void profPut32(char *b, u32 v) { b[0] = v & 255; @@ -111,6 +123,21 @@ int profWrite32(FILE *f, u32 v) return 0; } +#ifdef __APPLE__ +int profWrite64(FILE *f, u64 v) +{ + char buf[8]; + + profPut64(buf, v); + if(fwrite(buf, 1, 8, f) != 8) + return 1; + return 0; +} +#define profWriteMemptr profWrite64 +#else +#define profWriteMemptr profWrite32 +#endif + int profWrite(FILE *f, char *buf, unsigned int n) { if(fwrite(buf, 1, n, f) != n) @@ -266,7 +293,7 @@ void profCleanup() for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) { if(profWrite8(fd, GMON_TAG_CG_ARC) || profWrite32(fd, (u32)frompc) || - profWrite32(fd, (u32)tos[toindex].selfpc) || + profWriteMemptr(fd, (memptr)tos[toindex].selfpc) || profWrite32(fd, tos[toindex].count)) { systemMessage(0, "mcount: arc"); fclose(fd); diff --git a/src/sdl/debugger.cpp b/src/sdl/debugger.cpp index 1657a9e..4d89d99 100644 --- a/src/sdl/debugger.cpp +++ b/src/sdl/debugger.cpp @@ -946,13 +946,13 @@ void debuggerBreakArm(int n, char **args) debuggerUsage("ba"); } -void debuggerBreakOnWrite(u32 *mem, u32 oldvalue, u32 value, int size) +void debuggerBreakOnWrite(memptr *mem, u32 oldvalue, u32 value, int size) { - u32 address = 0; - if(mem >= (u32*)&workRAM[0] && mem <= (u32*)&workRAM[0x3ffff]) - address = 0x2000000 + ((u32)mem - (u32)&workRAM[0]); + memptr address = 0; + if(mem >= (memptr*)&workRAM[0] && mem <= (memptr*)&workRAM[0x3ffff]) + address = 0x2000000 + ((memptr)mem - (memptr)&workRAM[0]); else - address = 0x3000000 + ((u32)mem - (u32)&internalRAM[0]); + address = 0x3000000 + ((memptr)mem - (memptr)&internalRAM[0]); if(size == 2) printf("Breakpoint (on write) address %08x old:%08x new:%08x\n",