void DebugCLI::deleteBreakpoint(char *idstr) { int id = VMPI_atoi(idstr); BreakAction *breakAction = firstBreakAction; while (breakAction) { if (breakAction->id == id) { break; } breakAction = breakAction->next; } if (breakAction) { if (breakAction->prev) { breakAction->prev->next = breakAction->next; } else { firstBreakAction = breakAction->next; } if (breakAction->next) { breakAction->next->prev = breakAction->prev; } else { lastBreakAction = breakAction->prev; } if (breakpointClear(breakAction->sourceFile, breakAction->linenum)) { core->console << "Breakpoint " << id << " deleted.\n"; } else { core->console << "Internal error; could not delete breakpoint.\n"; } } else { core->console << "Could not find breakpoint.\n"; } }
void DebugCLI::breakpoint(char *location) { Stringp filename = currentFile; char *colon = VMPI_strchr(location, ':'); if (colon) { *colon = 0; filename = core->internStringLatin1(location); location = colon+1; } if (abcCount() == 0) { core->console << "No abc file loaded\n"; return; } SourceFile* sourceFile = NULL; for (int i = 0, n = abcCount(); i < n; ++i) { AbcFile* abcFile = (AbcFile*)abcAt(i); sourceFile = abcFile->sourceNamed(filename); if (sourceFile) break; } if (sourceFile == NULL) { core->console << "No source available; can't set breakpoint.\n"; return; } int targetLine = VMPI_atoi(location); int breakpointId = ++breakpointCount; if (breakpointSet(sourceFile, targetLine)) { core->console << "Breakpoint " << breakpointId << ": file " << filename << ", " << (targetLine) << ".\n"; BreakAction *breakAction = new (core->GetGC()) BreakAction(sourceFile, breakpointId, filename, targetLine); breakAction->prev = lastBreakAction; if (lastBreakAction) { lastBreakAction->next = breakAction; } else { firstBreakAction = breakAction; } lastBreakAction = breakAction; } else { core->console << "Could not locate specified line.\n"; } }
/*static*/ int CStdlibClass::atoi(ScriptObject* self, Stringp str) { Toplevel* toplevel = self->toplevel(); if (!str) { toplevel->throwArgumentError(kNullArgumentError, "str"); } StUTF8String strUTF8(str); return VMPI_atoi( strUTF8.c_str() ); }
void DebugCLI::list(const char* line) { int currentLine = (core->callStack) ? core->callStack->linenum() : 0; int linenum = (line) ? VMPI_atoi(line) : currentLine; displayLines(linenum, 10); }