Changeset 8dd3ac in git
- Timestamp:
- Apr 20, 1999, 7:02:49 PM (25 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 71f6706ea153c065bbdd021bb4c72b845656104c
- Parents:
- 7c0745a074f1698979a57dcb6b2c59a48277e802
- Location:
- Singular
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/attrib.cc
r7c0745 r8dd3ac 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: attrib.cc,v 1.1 2 1999-04-15 17:28:02Singular Exp $ */4 /* $Id: attrib.cc,v 1.13 1999-04-20 17:02:45 Singular Exp $ */ 5 5 6 6 /* … … 263 263 } 264 264 attr at=v->attribute; 265 if (v->Typ()==PROC_CMD)266 {267 procinfo *p=(procinfo *)v->Data();268 if (p->trace_flag!=0)269 Print("TRACE:%d\n",p->trace_flag);270 }271 265 if (hasFlag(v,FLAG_STD)) 272 266 { … … 300 294 res->data=(void *)(((ideal)v->Data())->rank); 301 295 } 302 else if ((v->Typ()==PROC_CMD) && (strcmp(name,"TRACE")==0))303 {304 procinfo *p=(procinfo *)v->Data();305 res->rtyp=INT_CMD;306 res->data=(void *)p->trace_flag;307 }308 296 else 309 297 { … … 362 350 I->rank=max(I->rank,(int)c->Data()); 363 351 } 364 else if ((strcmp(name,"TRACE")==0)&&(v->Typ()==PROC_CMD))365 {366 if (c->Typ()!=INT_CMD)367 {368 WerrorS("attrib `TRACE` must be int");369 return TRUE;370 }371 procinfo *p=(procinfo *)v->Data();372 p->trace_flag=(int)c->Data();373 }374 352 #ifdef DRING 375 353 else if (strcmp(name,"D")==0) -
Singular/extra.cc
r7c0745 r8dd3ac 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.8 8 1999-01-22 17:40:49Singular Exp $ */4 /* $Id: extra.cc,v 1.89 1999-04-20 17:02:47 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 48 48 #include "kstd1.h" 49 49 #include "syz.h" 50 #include "sdb.h" 50 51 51 52 // Define to enable many more system commands … … 905 906 else 906 907 #endif 908 /*==================== sdb-debugger =================*/ 909 if (strcmp(sys_cmd, "breakpoint") == 0) 910 { 911 if ((h!=NULL) && (h->Typ()==PROC_CMD)) 912 { 913 procinfov p=(procinfov)h->Data(); 914 if (p->language!=LANG_SINGULAR) 915 { 916 WerrorS("set breakpoints only in Singular procedures"); 917 return TRUE; 918 } 919 int lineno=p->data.s.body_lineno; 920 if ((h->next!=NULL) && (h->next->Typ()==INT_CMD)) 921 { 922 lineno=(int)h->next->Data(); 923 } 924 int i; 925 if (lineno== -1) 926 { 927 i=p->trace_flag; 928 p->trace_flag &=1; 929 Print("breakpoints in %s deleted(%#x)\n",p->procname,i &255); 930 return FALSE; 931 } 932 i=0; 933 while((i<7) && (sdb_lines[i]!=-1)) i++; 934 if (sdb_lines[i]!= -1) 935 { 936 PrintS("too many breakpoints set, max is 7\n"); 937 return FALSE; 938 } 939 else 940 { 941 sdb_lines[i]=lineno; 942 i++; 943 Print("breakpoint %d, at line %d in %s\n",i,lineno,p->procname); 944 p->trace_flag|=(1<<i); 945 } 946 } 947 else 948 { 949 WerrorS("system(\"breakpoint\",`proc`,`int`) expected"); 950 return TRUE; 951 } 952 return FALSE; 953 } 954 else 907 955 /*==================== print all option values =================*/ 908 956 #ifndef NDEBUG -
Singular/febase.inc
r7c0745 r8dd3ac 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: febase.inc,v 1.2 1 1999-04-15 17:28:02Singular Exp $ */4 /* $Id: febase.inc,v 1.22 1999-04-20 17:02:48 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: handling of 'voices' … … 393 393 ) 394 394 || (traceit&TRACE_SHOW_LINE) 395 || (traceit&TRACE_SHOW_LINE1) 396 || ((currentVoice->pi!=NULL)&&(currentVoice->pi->trace_flag&TRACE_SHOW_LINE))) 395 || (traceit&TRACE_SHOW_LINE1)) 397 396 { 398 397 if (currentVoice->typ!=BT_example) … … 422 421 } 423 422 } 424 else if ((traceit&TRACE_SHOW_LINENO) 425 || ((currentVoice->pi!=NULL)&&(currentVoice->pi->trace_flag&TRACE_SHOW_LINENO))) 423 else if (traceit&TRACE_SHOW_LINENO) 426 424 { 427 425 Print("{%d}",yylineno); … … 430 428 if ((blocknest==0) 431 429 && (currentVoice->pi!=NULL) 432 && (currentVoice->pi->trace_flag &TRACE_BREAKPOINT))430 && (currentVoice->pi->trace_flag!=0)) 433 431 { 434 432 sdb(currentVoice, anf, len_s); -
Singular/sdb.cc
r7c0745 r8dd3ac 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: sdb.cc,v 1. 1 1999-04-15 17:28:47Singular Exp $ */4 /* $Id: sdb.cc,v 1.2 1999-04-20 17:02:48 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: Singular debugger … … 9 9 #include "mod2.h" 10 10 #include "tok.h" 11 #include "mmemory.h" 11 12 #include "febase.h" 12 13 #include "ipshell.h" 14 #include "ipid.h" 13 15 #include "sdb.h" 16 17 int sdb_lines[6]={-1,-1,-1,-1,-1,-1,-1}; 18 19 int sdb_checkline(char f) 20 { 21 int i; 22 char ff=f>>1; 23 for(i=0;i<7;i++) 24 { 25 if((ff & 1) && (yylineno==sdb_lines[i])) 26 return i+1; 27 ff>>=1; 28 if (ff==0) return 0; 29 } 30 return 0; 31 } 32 33 static char sdb_lastcmd='c'; 14 34 15 35 void sdb(Voice * currentVoice, char * currLine, int len) 16 36 { 17 loop 37 int bp=0; 38 if ((len>1) 39 && ((currentVoice->pi->trace_flag & 1) 40 || (bp=sdb_checkline(currentVoice->pi->trace_flag))) 41 ) 18 42 { 19 char gdb[80]; 20 char *p=currLine+len-1; 21 while ((*p<=' ') && (p!=currLine)) 43 loop 22 44 { 23 p--; len--; 24 } 25 if (p!=currLine) 26 { 45 char gdb[80]; 46 char *p=currLine+len-1; 47 while ((*p<=' ') && (p!=currLine)) 48 { 49 p--; len--; 50 } 51 if (p==currLine) return; 52 53 currentVoice->pi->trace_flag&= ~1; // delete flag for "all lines" 27 54 fprintf(stdout,"(%s,%d) >>",currentVoice->filename,yylineno);mflush(); 28 55 fwrite(currLine,1,len,stdout); 29 fprintf(stdout,"<< (p, f-finish,b,...)\n");mflush();56 fprintf(stdout,"<<\nbreakpoint %d (p..,f,b,c,n,q,e..)\n",bp);mflush(); 30 57 fgets(gdb,80,stdin); 31 58 p=gdb; 32 59 while (*p==' ') p++; 33 60 if (*p >' ') 34 printf("command:%c\n",*p);35 switch(*p)36 61 { 37 case 'f': 38 currentVoice->pi->trace_flag&= ~TRACE_BREAKPOINT; 62 sdb_lastcmd=*p; 63 } 64 printf("command:%c\n",sdb_lastcmd); 65 switch(sdb_lastcmd) 66 { 67 case 'd': 68 currentVoice->pi->trace_flag &= (~Sy_bit(bp)); 69 break; 70 case 'n': 71 currentVoice->pi->trace_flag|= 1; 39 72 return; 73 // case 'e': 74 // { 75 // sdb_lastcmd='c'; 76 // if (*(p+1)!=' ') 77 // { 78 // printf("?? no string to execute\n"); 79 // } 80 // else 81 // { 82 // p+=2; 83 // char *s=(char *)AllocL(strlen(p) + 4); 84 // strcpy( s,p); 85 // strcat( s,"\n;\n"); 86 // newBuffer(s,BT_execute); 87 // } 88 // return; 89 // } 40 90 case 'p': 41 printf(".....\n"); 91 { 92 p+=2; 93 char *pp=p+1; 94 while (*pp>' ') pp++; 95 *pp='\0'; 96 printf("request `%s`",p); 97 idhdl h=ggetid(p,TRUE); 98 if (h==NULL) printf("NULL\n"); 99 else 100 { 101 sleftv tmp; 102 memset(&tmp,0,sizeof(tmp)); 103 tmp.rtyp=IDHDL; 104 tmp.data=h; 105 printf("(type %s):",Tok2Cmdname(tmp.Typ())); 106 tmp.Print(); 107 } 42 108 break; 109 } 43 110 case 'b': 44 111 VoiceBackTrack(); 45 112 break; 46 113 case 'q': 47 114 m2_end(999); 115 case 'c': 48 116 default: 49 117 return; -
Singular/sdb.h
r7c0745 r8dd3ac 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: sdb.h,v 1. 1 1999-04-15 17:28:48Singular Exp $ */6 /* $Id: sdb.h,v 1.2 1999-04-20 17:02:49 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: Singular debugger … … 11 11 #include "febase.h" 12 12 13 extern int sdb_lines[]; 14 13 15 void sdb(Voice * currentVoice, char * currLine, int len); 14 16 #endif
Note: See TracChangeset
for help on using the changeset viewer.