Fixed the debug printf feature in the case where a debugger is not attached.

This commit is contained in:
skidau 2015-04-19 10:13:53 +00:00
parent 6a987e31b7
commit 9ef3e205b0
3 changed files with 20 additions and 1 deletions

View File

@ -255,7 +255,7 @@ char *(patchNames[PATCH_MAX_NUM]) = { NULL }; // and so on
void(*dbgMain)() = remoteStubMain;
void(*dbgSignal)(int, int) = remoteStubSignal;
void(*dbgOutput)(const char *, u32) = remoteOutput;
void(*dbgOutput)(const char *, u32) = debuggerOutput;
char* homeDir = NULL;
char* arg0 = NULL;

View File

@ -273,6 +273,23 @@ void printBreakRegList(bool verbose){
}
void debuggerOutput(const char *s, u32 addr)
{
if (s)
printf("%s", s);
else {
char c;
c = debuggerReadByte(addr);
addr++;
while (c) {
putchar(c);
c = debuggerReadByte(addr);
addr++;
}
}
}
// checks that the given address is in the DB list
bool debuggerInDB(u32 address)
{

View File

@ -43,6 +43,8 @@ extern void dexp_listVars();
extern void dexp_saveVars(char *);
extern void dexp_loadVars(char *);
void debuggerOutput(const char *s, u32 addr);
bool debuggerBreakOnExecution(u32 address, u8 state);
bool debuggerBreakOnWrite(u32 address, u32 value, int size);
void debuggerBreakOnWrite(u32 address, u32 oldvalue, u32 value, int size, int t);