#define GDB_DEBUG_CONSOLE
#endif
-extern char * strrchr(char * s, char c);
+extern char * strrchr(const char * s, int c);
#define uint _uint
#include <stdarg.h>
enum DebuggerState { none, prompt, loaded, running, stopped, terminated };
enum DebuggerEvent { none, hit, breakEvent, signal, stepEnd, functionEnd, exit };
enum DebuggerAction { none, internal, restart, stop, selectFrame }; //, bpValidation
-enum BreakpointType { none, internalMain, internalWinMain, internalModulesLoaded, user, runToCursor };
+enum BreakpointType { none, internalMain, internalWinMain, internalModulesLoaded, user, runToCursor, internalModuleLoad };
enum DebuggerEvaluationError { none, symbolNotFound, memoryCantBeRead, unknown };
FileDialog debuggerFileDialog { type = selectDir };
bpHit = bp;
if(!(!userBreakOnInternBreak &&
- bp && (bp.type == internalMain || bp.type == internalWinMain || bp.type == internalModulesLoaded)))
+ bp && (bp.type == internalMain || bp.type == internalWinMain ||
+ bp.type == internalModulesLoaded || bp.type == internalModuleLoad)))
monitor = true;
hitThread = stopItem.threadid;
}
sysBPs.Add(Breakpoint { type = internalWinMain, enabled = true, level = -1 });
#endif
sysBPs.Add(Breakpoint { type = internalModulesLoaded, enabled = true, level = -1 });
-
+ sysBPs.Add(Breakpoint { type = internalModuleLoad, enabled = true, level = -1 });
}
~Debugger()
else if(expression)
{
wh = Watch { };
- row.tag = (int)wh;
+ row.tag = (int64)wh;
ide.workspace.watches.Add(wh);
wh.row = row;
wh.expression = CopyString(expression);
bp.bp = bpItem;
bpItem = null;
bp.inserted = (bp.bp && bp.bp.number != 0);
- ValidateBreakpoint(bp);
}
delete f;
}
- break;
+ }
+ else if(bp.type == internalModuleLoad && modules)
+ {
+ Project ecerePrj = null;
+ for(p : ide.workspace.projects)
+ {
+ if(!strcmp(p.topNode.name, "ecere.epj"))
+ {
+ ecerePrj = p;
+ break;
+ }
+ }
+ if(ecerePrj)
+ {
+ ProjectNode node = ecerePrj.topNode.Find("instance.c", false);
+ if(node)
+ {
+ char path[MAX_LOCATION];
+ char relative[MAX_LOCATION];
+ node.GetFullFilePath(path);
+ bp.absoluteFilePath = CopyString(path);
+ MakePathRelative(path, ecerePrj.topNode.path, relative);
+ delete bp.relativeFilePath;
+ bp.relativeFilePath = CopyString(relative);
+ sentBreakInsert = true;
+ GdbCommand(false, "-break-insert %s:InternalModuleLoadBreakpoint", bp.relativeFilePath);
+ bp.bp = bpItem;
+ bpItem = null;
+ bp.inserted = (bp.bp && bp.bp.number != 0);
+ }
+ }
}
}
}
if(exp.expType.kind != arrayType || exp.hasAddress)
{
- uint address;
+ uint64 address;
char * string;
char value[4196];
int len;
sprintf(temp, "(char*)%s", exp.constant);*/
//evaluation = Debugger::EvaluateExpression(temp, &evalError);
- address = strtoul(exp.constant, null, 0);
+ // address = strtoul(exp.constant, null, 0);
+ address = _strtoui64(exp.constant, null, 0);
//printf("%x\n", address);
- snprintf(value, sizeof(value), "0x%08x ", address);
+ // snprintf(value, sizeof(value), "0x%08x ", address);
+
+ if(address > 0xFFFFFFFFLL)
+ snprintf(value, sizeof(value), (GetRuntimePlatform() == win32) ? "0x%016I64x " : "0x%016llx ", address);
+ else
+ snprintf(value, sizeof(value), (GetRuntimePlatform() == win32) ? "0x%08I64x " : "0x%08llx ", address);
value[sizeof(value)-1] = 0;
if(!address)
default:
if(exp.hasAddress)
{
- wh.value = PrintHexUInt(exp.address);
+ wh.value = PrintHexUInt64(exp.address);
result = (bool)exp.address;
}
else
}
// to be removed... use GdbReadMemory that returns a byte array instead
- char * ::GdbReadMemoryString(uint address, int size, char format, int rows, int cols)
+ char * ::GdbReadMemoryString(uint64 address, int size, char format, int rows, int cols)
{
eval.active = true;
eval.error = none;
if(!size)
printf("GdbReadMemoryString called with size = 0!\n");
#endif
- GdbCommand(false, "-data-read-memory 0x%08x %c, %d, %d, %d", address, format, size, rows, cols);
+ // GdbCommand(false, "-data-read-memory 0x%08x %c, %d, %d, %d", address, format, size, rows, cols);
+ if(GetRuntimePlatform() == win32)
+ GdbCommand(false, "-data-read-memory 0x%016I64x %c, %d, %d, %d", address, format, size, rows, cols);
+ else
+ GdbCommand(false, "-data-read-memory 0x%016llx %c, %d, %d, %d", address, format, size, rows, cols);
if(eval.active)
ide.outputView.debugBox.Logf("Debugger Error: GdbReadMemoryString\n");
return eval.result;
}
- byte * ::GdbReadMemory(uint address, int bytes)
+ byte * ::GdbReadMemory(uint64 address, int bytes)
{
eval.active = true;
eval.error = none;
- GdbCommand(false, "-data-read-memory 0x%08x %c, 1, 1, %d", address, 'u', bytes);
+ //GdbCommand(false, "-data-read-memory 0x%08x %c, 1, 1, %d", address, 'u', bytes);
+ if(GetRuntimePlatform() == win32)
+ GdbCommand(false, "-data-read-memory 0x%016I64x %c, 1, 1, %d", address, 'u', bytes);
+ else
+ GdbCommand(false, "-data-read-memory 0x%016llx %c, 1, 1, %d", address, 'u', bytes);
#ifdef _DEBUG
if(!bytes)
printf("GdbReadMemory called with bytes = 0!\n");
break;
case internalModulesLoaded:
modules = true;
+ GdbInsertInternalBreakpoint();
+ GdbBreakpointsInsert();
+ GdbExecContinue(false);
+ break;
+ case internalModuleLoad:
GdbBreakpointsInsert();
GdbExecContinue(false);
break;
else if(!strcmp(item.name, "next-row"))
{
StripQuotes(item.value, item.value);
- eval.nextBlockAddress = strtoul(item.value, null, 0);
+ eval.nextBlockAddress = _strtoui64(item.value, null, 0);
}
else if(!strcmp(item.name, "memory"))
{
return result;
}
- char * ::ReadMemory(uint address, int size, char format, ExpressionType * error)
+ char * ::ReadMemory(uint64 address, int size, char format, ExpressionType * error)
{
// check for state
char * result = GdbReadMemoryString(address, size, format, 1, 1);
bool active;
char * result;
int bytes;
- uint nextBlockAddress;
+ uint64 nextBlockAddress;
DebuggerEvaluationError error;
};