Esempio n. 1
0
void fx_xs_debug_setBreakpoint(txMachine* the)
{
	if ((mxArgc < 1) || (!mxIsStringPrimitive(mxArgv(0))))
		mxTypeError("file is no string");
	if ((mxArgc < 2) || (!mxIsStringPrimitive(mxArgv(1))))
		mxTypeError("line is no string");
	fxSetBreakpoint(the, mxArgv(0)->value.string, mxArgv(1)->value.string);
}
Esempio n. 2
0
void
xs_dbg_setBreakpoint(xsMachine *the)
{
#if mxDebug
	char num[13];

	xsToStringBuffer(xsArg(1), num, sizeof(num));
	fxSetBreakpoint(the, xsToString(xsArg(0)), num);
#endif
}
Esempio n. 3
0
void fxWriteAddressAutomatic(txMachine* the)
{
	/* write debugAddress and debugAutomatic to a file... */
#if TARGET_OS_ANDROID
	char *folder = NULL;
	char *file = FskStrDoCat(folder, "/sdcard/debug.txt");
	{
#else
	char *folder;
	if (kFskErrNone == FskDirectoryGetSpecialPath(kFskDirectorySpecialTypeApplicationPreference, true, NULL, &folder)) {
		char *file = FskStrDoCat(folder, "debug.txt");
#endif
		FskFile fref;

		FskFileDelete(file);
		FskFileCreate(file);
		if (kFskErrNone == FskFileOpen(file, kFskFilePermissionReadWrite, &fref)) {
			char *data = FskStrDoCat(debugAddress, debugAutomatic ? "\n1\n" : "\n0\n");
			if (data) {
				FskFileWrite(fref, FskStrLen(data), data, NULL);
				FskFileClose(fref);
				FskMemPtrDispose(data);
			}
		}
	}
}

#endif /* !KPR_CONFIG */ 

void fxReadBreakpoints(txMachine* the)
{
	char *breakpoints;
	FskMemPtr file = NULL;
	FskInt64 fileSize;
	char *p;

	FskECMAScriptGetDebug(NULL, &breakpoints, NULL);

	if ((NULL == breakpoints) || (0 == *breakpoints)) goto bail;

	if (kFskErrNone != FskFileLoad(breakpoints, &file, &fileSize))
		goto bail;

	p = (char *)file;
	while (true) {
		char *path = p;
		char *line = FskStrChr(p, '\t');
		char *cr;

		if (NULL == line)
			break;
		cr = FskStrChr(line, '\n');
		if (NULL == cr)
			break;
		*line++ = 0;
		*cr = 0;

		fxSetBreakpoint(the, path, line);

		p = cr + 1;
	}

bail:
	FskMemPtrDispose(file);
}