76 #ifdef HAVE_DYNAMIC_LOADING
79 PrintS(
"is not a Singular procedure\n");
84 if (given_lineno >0) lineno=given_lineno;
85 else lineno=p->
data.s.body_lineno;
87 if (given_lineno== -1)
98 PrintS(
"too many breakpoints set, max is 7\n");
105 Print(
"breakpoint %d, at line %d in %s\n",i,lineno,p->
procname);
112 char * filename =
omStrDup(
"/tmp/sd000000");
113 sprintf(filename+7,
"%d",getpid());
114 FILE *
fp=fopen(filename,
"w");
117 Print(
"cannot open %s\n",filename);
129 const char *editor=
getenv(
"EDITOR");
141 PrintS(
"cannot get the procedure body\n");
149 fwrite(pi->
data.s.body,1,strlen(pi->
data.s.body),fp);
159 if (strchr(editor,
' ')==
NULL)
161 execlp(editor,editor,filename,
NULL);
162 Print(
"cannot exec %s\n",editor);
166 char *
p=(
char *)
omAlloc(strlen(editor)+strlen(filename)+2);
167 sprintf(p,
"%s %s",editor,filename);
177 fp=fopen(filename,
"r");
180 Print(
"cannot read from %s\n",filename);
191 pi->
data.s.body[len]=
'\0';
212 char *
p=(
char *)currLine+len-1;
213 while ((*p<=
' ') && (p!=currLine))
217 if (p==currLine)
return;
221 fwrite(currLine,1,len,stdout);
222 Print(
"<<\nbreakpoint %d (press ? for list of commands)\n",bp);
236 "b - print backtrace of calling stack\n"
237 "B <proc> [<line>] - define breakpoint\n"
239 "d - delete current breakpoint\n"
240 "D - show all breakpoints\n"
241 "e - edit the current procedure (current call will be aborted)\n"
242 "h,? - display this help screen\n"
243 "n - execute current line, break at next line\n"
244 "p <var> - display type and value of the variable <var>\n"
245 "q <flags> - quit debugger, set debugger flags(0,1,2)\n"
246 " 0: stop debug, 1:continue, 2: throw an error, return to toplevel\n"
247 "Q - quit Singular\n");
252 Print(
"breakpoint %d at line %d in %s\n",
259 Print(
"delete break point %d\n",bp);
273 extern void listall(
int showproc);
291 Print(
"variable `%s`at level %d",p,myynest);
298 memset(&tmp,0,
sizeof(tmp));
312 Print(
"procedure `%s` ",p);
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Class used for (list of) interpreter objects.
void sdb_edit(procinfo *pi)
static char * sdb_find_arg(char *p)
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
void sdb(Voice *currentVoice, const char *currLine, int len)
int sdb_checkline(char f)
size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream)
void PrintS(const char *s)
BOOLEAN sdb_set_breakpoint(const char *pp, int given_lineno)
const char * Tok2Cmdname(int tok)
char * iiGetLibProcBuffer(procinfo *pi, int part)
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)