Changeset 3105b0 in git
- Timestamp:
- Aug 20, 1999, 6:06:49 PM (25 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 99a286c05af3b60f04f2443ada520b679a44e7a3
- Parents:
- eb4fa6810e4f32cc808925d5dc987963d1c02d5b
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
reb4fa6 r3105b0 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.10 2 1999-08-17 09:25:45Singular Exp $ */4 /* $Id: extra.cc,v 1.103 1999-08-20 16:06:49 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 49 49 #include "syz.h" 50 50 #include "sdb.h" 51 #include "version.h"52 51 53 52 // Define to enable many more system commands … … 954 953 if (strcmp(sys_cmd, "breakpoint") == 0) 955 954 { 956 if ((h!=NULL) && (h->Typ()==PROC_CMD)) 957 { 958 procinfov p=(procinfov)h->Data(); 959 if (p->language!=LANG_SINGULAR) 960 { 961 WerrorS("set breakpoints only in Singular procedures"); 962 return TRUE; 963 } 964 int lineno=p->data.s.body_lineno; 955 if (h==NULL) 956 { 957 sdb_show_bp(); 958 return FALSE; 959 } 960 else if (h->Typ()==PROC_CMD) 961 { 962 int lineno=0; 965 963 if ((h->next!=NULL) && (h->next->Typ()==INT_CMD)) 966 964 { 967 965 lineno=(int)h->next->Data(); 968 966 } 969 int i; 970 if (lineno== -1) 971 { 972 i=p->trace_flag; 973 p->trace_flag &=1; 974 Print("breakpoints in %s deleted(%#x)\n",p->procname,i &255); 975 return FALSE; 976 } 977 i=0; 978 while((i<7) && (sdb_lines[i]!=-1)) i++; 979 if (sdb_lines[i]!= -1) 980 { 981 PrintS("too many breakpoints set, max is 7\n"); 982 return FALSE; 983 } 984 else 985 { 986 sdb_lines[i]=lineno; 987 sdb_files[i]=p->libname; 988 i++; 989 Print("breakpoint %d, at line %d in %s\n",i,lineno,p->procname); 990 p->trace_flag|=(1<<i); 991 } 992 } 993 else 994 { 995 WerrorS("system(\"breakpoint\",`proc`,`int`) expected"); 967 return sdb_set_breakpoint(h->Name(),lineno); 968 } 969 else 970 { 971 WerrorS("system(\"breakpoint\",`proc`[,`int`]) expected"); 996 972 return TRUE; 997 973 } 998 return FALSE;999 974 } 1000 975 else -
Singular/sdb.cc
reb4fa6 r3105b0 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: sdb.cc,v 1. 9 1999-06-10 15:14:03Singular Exp $ */4 /* $Id: sdb.cc,v 1.10 1999-08-20 16:06:48 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: Singular debugger … … 17 17 #include "sdb.h" 18 18 19 // We use 8 breakpoints - corresponding to a bit in a char variable in procinfo 20 // bit 1..7 force a breakpoint, if lineno==sdb_lines[i-1], 21 // (for displaying only: file sdb_files[i-1]) 22 // bit 0 force a breakpoint in every line (used for 'n') 23 19 24 int sdb_lines[]={-1,-1,-1,-1,-1,-1,-1,-1}; 20 25 char * sdb_files[6]; … … 33 38 } 34 39 return 0; 40 } 41 42 static char *sdb_find_arg(char *p) 43 { 44 p++; 45 while (*p==' ') p++; 46 char *pp=p; 47 while (*pp>' ') pp++; 48 *pp='\0'; 49 return p; 50 } 51 52 void sdb_show_bp() 53 { 54 for(int i=0; i<7;i++) 55 if (sdb_lines[i]!= -1) 56 Print("Breakpoint %d: %s::%d\n",i+1,sdb_files[i],sdb_lines[i]); 57 } 58 59 BOOLEAN sdb_set_breakpoint(const char *pp, int given_lineno) 60 { 61 idhdl h=ggetid(pp,TRUE); 62 if ((h==NULL)||(IDTYP(h)!=PROC_CMD)) 63 { 64 PrintS(" not found\n"); 65 return TRUE; 66 } 67 else 68 { 69 procinfov p=(procinfov)IDDATA(h); 70 #ifdef HAVE_DYNAMIC_LOADING 71 if (p->language!=LANG_SINGULAR) 72 { 73 PrintS("is not a Singular procedure\n"); 74 return TRUE; 75 } 76 #endif 77 int lineno; 78 if (given_lineno >0) lineno=given_lineno; 79 else lineno=p->data.s.body_lineno; 80 int i; 81 if (given_lineno== -1) 82 { 83 i=p->trace_flag; 84 p->trace_flag &=1; 85 Print("breakpoints in %s deleted(%#x)\n",p->procname,i &255); 86 return FALSE; 87 } 88 i=0; 89 while((i<7) && (sdb_lines[i]!=-1)) i++; 90 if (sdb_lines[i]!= -1) 91 { 92 PrintS("too many breakpoints set, max is 7\n"); 93 return TRUE; 94 } 95 sdb_lines[i]=lineno; 96 sdb_files[i]=p->libname; 97 i++; 98 p->trace_flag|=(1<<i); 99 Print("breakpoint %d, at line %d in %s\n",i,lineno,p->procname); 100 return FALSE; 101 } 35 102 } 36 103 … … 122 189 unlink(filename); 123 190 FreeL(filename); 124 }125 126 static char *sdb_find_arg(char *p)127 {128 p++;129 while (*p==' ') p++;130 char *pp=p;131 while (*pp>' ') pp++;132 *pp='\0';133 return p;134 191 } 135 192 … … 172 229 PrintS( 173 230 "b - print backtrace of calling stack\n" 231 "B <proc> [<line>] - define breakpoint\n" 174 232 "c - continue\n" 175 233 "d - delete current breakpoint\n" 234 "D - show all preakpoints\n" 176 235 "e - edit the current procedure (current call will be aborted)\n" 177 236 "h,? - display this help screen\n" … … 199 258 break; 200 259 } 260 case 'D': 261 sdb_show_bp(); 262 break; 201 263 case 'n': 202 264 currentVoice->pi->trace_flag|= 1; … … 211 273 { 212 274 p=sdb_find_arg(p); 213 Print(" request`%s`",p);275 Print("variable `%s`",p); 214 276 idhdl h=ggetid(p,TRUE); 215 277 if (h==NULL) 216 PrintS(" NULL\n");278 PrintS(" not found\n"); 217 279 else 218 280 { … … 229 291 VoiceBackTrack(); 230 292 break; 293 case 'B': 294 { 295 p=sdb_find_arg(p); 296 Print("procedure `%s` ",p); 297 sdb_set_breakpoint(p); 298 break; 299 } 231 300 case 'q': 232 301 { -
Singular/sdb.h
reb4fa6 r3105b0 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: sdb.h,v 1. 4 1999-05-06 16:53:25Singular Exp $ */6 /* $Id: sdb.h,v 1.5 1999-08-20 16:06:49 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: Singular debugger … … 17 17 18 18 void sdb_edit(procinfo *pi); 19 void sdb_show_bp(); 20 BOOLEAN sdb_set_breakpoint(const char *p, int lineno=0); 19 21 void sdb(Voice * currentVoice, const char * currLine, int len); 20 22 #endif
Note: See TracChangeset
for help on using the changeset viewer.