MCPcopy Create free account
hub / github.com/Singular/Singular / sdb

Function sdb

Singular/sdb.cc:210–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208STATIC_VAR char sdb_lastcmd='c';
209
210void sdb(Voice * currentVoice, const char * currLine, int len)
211{
212 int bp=0;
213 if ((len>1)
214 && ((currentVoice->pi->trace_flag & 1)
215 || (bp=sdb_checkline(currentVoice->pi->trace_flag)))
216 )
217 {
218 loop
219 {
220 char gdb[80];
221 char *p=(char *)currLine+len-1;
222 while ((*p<=' ') && (p!=currLine))
223 {
224 p--; len--;
225 }
226 if (p==currLine) return;
227
228 currentVoice->pi->trace_flag&= ~1; // delete flag for "all lines"
229 Print("(%s,%d) >>",currentVoice->filename,yylineno);
230 fwrite(currLine,1,len,stdout);
231 Print("<<\nbreakpoint %d (press ? for list of commands)\n",bp);
232 p=fe_fgets_stdin(">>",gdb,80);
233 while (*p==' ') p++;
234 if (*p >' ')
235 {
236 sdb_lastcmd=*p;
237 }
238 Print("command:%c\n",sdb_lastcmd);
239 switch(sdb_lastcmd)
240 {
241 case '?':
242 case 'h':
243 {
244 PrintS(
245 "b - print backtrace of calling stack\n"
246 "B <proc> [<line>] - define breakpoint\n"
247 "c - continue\n"
248 "d - delete current breakpoint\n"
249 "D - show all breakpoints\n"
250 "e - edit the current procedure (current call will be aborted)\n"
251 "h,? - display this help screen\n"
252 "n - execute current line, break at next line\n"
253 "p <var> - display type and value of the variable <var>\n"
254 "q <flags> - quit debugger, set debugger flags(0,1,2)\n"
255 " 0: stop debug, 1:continue, 2: throw an error, return to toplevel\n"
256 "Q - quit Singular\n");
257 int i;
258 for(i=0;i<7;i++)
259 {
260 if (sdb_lines[i] != -1)
261 Print("breakpoint %d at line %d in %s\n",
262 i,sdb_lines[i],sdb_files[i]);
263 }
264 break;
265 }
266 case 'd':
267 {

Callers 1

fePrintEchoFunction · 0.85

Calls 14

sdb_checklineFunction · 0.85
PrintSFunction · 0.85
sdb_show_bpFunction · 0.85
listallFunction · 0.85
sdb_editFunction · 0.85
sdb_find_argFunction · 0.85
ggetidFunction · 0.85
VoiceBackTrackFunction · 0.85
sdb_set_breakpointFunction · 0.85
m2_endFunction · 0.85
Tok2CmdnameFunction · 0.70
PrintFunction · 0.50

Tested by

no test coverage detected