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/sd000000");
112 sprintf(filename+7,
"%d",getpid());
113 FILE *
fp=fopen(filename,
"w");
116 Print(
"cannot open %s\n",filename);
122 Print(
"cannot edit type %d\n",
pi->language);
128 const char *editor=
getenv(
"EDITOR");
135 if (
pi->data.s.body==
NULL)
138 if (
pi->data.s.body==
NULL)
140 PrintS(
"cannot get the procedure body\n");
148 fwrite(
pi->data.s.body,1,strlen(
pi->data.s.body),
fp);
158 if (strchr(editor,
' ')==
NULL)
160 execlp(editor,editor,filename,
NULL);
161 Print(
"cannot exec %s\n",editor);
165 char *
p=(
char *)
omAlloc(strlen(editor)+strlen(filename)+2);
166 sprintf(
p,
"%s %s",editor,filename);
176 fp=fopen(filename,
"r");
179 Print(
"cannot read from %s\n",filename);
188 pi->data.s.body=(
char *)
omAlloc((
int)len+1);
190 pi->data.s.body[len]=
'\0';
211 char *
p=(
char *)currLine+len-1;
212 while ((*
p<=
' ') && (
p!=currLine))
216 if (
p==currLine)
return;
220 fwrite(currLine,1,len,stdout);
221 Print(
"<<\nbreakpoint %d (press ? for list of commands)\n",bp);
235 "b - print backtrace of calling stack\n"
236 "B <proc> [<line>] - define breakpoint\n"
238 "d - delete current breakpoint\n"
239 "D - show all breakpoints\n"
240 "e - edit the current procedure (current call will be aborted)\n"
241 "h,? - display this help screen\n"
242 "n - execute current line, break at next line\n"
243 "p <var> - display type and value of the variable <var>\n"
244 "q <flags> - quit debugger, set debugger flags(0,1,2)\n"
245 " 0: stop debug, 1:continue, 2: throw an error, return to toplevel\n"
246 "Q - quit Singular\n");
251 Print(
"breakpoint %d at line %d in %s\n",
258 Print(
"delete break point %d\n",bp);
272 extern void listall(
int showproc);
297 memset(&tmp,0,
sizeof(tmp));
311 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