75 #ifdef HAVE_DYNAMIC_LOADING
78 PrintS(
"is not a Singular procedure\n");
83 if (given_lineno >0) lineno=given_lineno;
84 else lineno=
p->data.s.body_lineno;
86 if (given_lineno== -1)
90 Print(
"breakpoints in %s deleted(%#x)\n",
p->procname,
i &255);
97 PrintS(
"too many breakpoints set, max is 7\n");
103 p->trace_flag|=(1<<
i);
104 Print(
"breakpoint %d, at line %d in %s\n",
i,lineno,
p->procname);
111 char * filename =
omStrDup(
"/tmp/sdXXXXXX");
112 int f=mkstemp(filename);
115 Print(
"cannot open %s\n",filename);
121 Print(
"cannot edit type %d\n",
pi->language);
126 const char *editor=
getenv(
"EDITOR");
133 if (
pi->data.s.body==
NULL)
136 if (
pi->data.s.body==
NULL)
138 PrintS(
"cannot get the procedure body\n");
146 write(
f,
pi->data.s.body,strlen(
pi->data.s.body));
156 if (strchr(editor,
' ')==
NULL)
158 execlp(editor,editor,filename,
NULL);
159 Print(
"cannot exec %s\n",editor);
163 char *
p=(
char *)
omAlloc(strlen(editor)+strlen(filename)+2);
164 sprintf(
p,
"%s %s",editor,filename);
174 FILE*
fp=fopen(filename,
"r");
177 Print(
"cannot read from %s\n",filename);
186 pi->data.s.body=(
char *)
omAlloc((
int)len+1);
188 pi->data.s.body[len]=
'\0';
209 char *
p=(
char *)currLine+len-1;
210 while ((*
p<=
' ') && (
p!=currLine))
214 if (
p==currLine)
return;
218 fwrite(currLine,1,len,stdout);
219 Print(
"<<\nbreakpoint %d (press ? for list of commands)\n",bp);
233 "b - print backtrace of calling stack\n"
234 "B <proc> [<line>] - define breakpoint\n"
236 "d - delete current breakpoint\n"
237 "D - show all breakpoints\n"
238 "e - edit the current procedure (current call will be aborted)\n"
239 "h,? - display this help screen\n"
240 "n - execute current line, break at next line\n"
241 "p <var> - display type and value of the variable <var>\n"
242 "q <flags> - quit debugger, set debugger flags(0,1,2)\n"
243 " 0: stop debug, 1:continue, 2: throw an error, return to toplevel\n"
244 "Q - quit Singular\n");
249 Print(
"breakpoint %d at line %d in %s\n",
256 Print(
"delete break point %d\n",bp);
270 extern void listall(
int showproc);
295 memset(&tmp,0,
sizeof(tmp));
309 Print(
"procedure `%s` ",
p);
Class used for (list of) interpreter objects.
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream)
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
const char * Tok2Cmdname(int tok)
idhdl ggetid(const char *n)
char * iiGetLibProcBuffer(procinfo *pi, int part)
void PrintS(const char *s)
BOOLEAN sdb_set_breakpoint(const char *pp, int given_lineno)
void sdb_edit(procinfo *pi)
void sdb(Voice *currentVoice, const char *currLine, int len)
static char * sdb_find_arg(char *p)
int sdb_checkline(char f)
STATIC_VAR char sdb_lastcmd
int status int void size_t count write