comparison src/trace.c @ 84:9b661787d5ed

2Mbyte
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 11 Aug 2018 18:16:04 +0900
parents 8f3c0906adb9
children 6f7276831219
comparison
equal deleted inserted replaced
83:2e3d4b54ec2d 84:9b661787d5ed
140 " h,? print this\n" 140 " h,? print this\n"
141 ); 141 );
142 } 142 }
143 143
144 144
145 void setbreak(int adr,int count) ; 145 void setbreak(int adr,int count, int page) ;
146 int nexti(void); 146 int nexti(void);
147 147
148 void do_escape(void) { 148 void do_escape(void) {
149 char s[80]; 149 char s[80];
150 int adr,page; 150 int adr,page;
223 break; 223 break;
224 case 'f': // finish this call (until stack pop) 224 case 'f': // finish this call (until stack pop)
225 stkskip = sreg + 2; 225 stkskip = sreg + 2;
226 attention = escape = 1; 226 attention = escape = 1;
227 break; 227 break;
228 case 'b': // set break point 228 case 'b': { // set break point
229 if (s[1]) { 229 char *next = s;
230 char *next; 230 int page = -1;
231 if (next[1]=='p') {
232 next++;
233 if (next[1])
234 page = getarg(next+1,&next);
235 }
236 if (next[1]) {
231 int count = 0; 237 int count = 0;
232 int adr = getarg(s+1,&next); 238 int adr = getarg(next+1,&next);
233 if (next[0]) { 239 if (next[0]) {
234 count = getarg(next,&next); 240 count = getarg(next,&next);
235 } 241 }
236 setbreak(adr,count); 242 setbreak(adr,count,page);
237 } else { 243 } else {
238 setbreak(pcreg,0); 244 setbreak(pcreg,0,page);
239 } 245 }
240 bpskip = -1; 246 bpskip = -1;
241 goto restart; 247 goto restart;
248 }
242 case 'B': // break point list 249 case 'B': // break point list
243 for(BPTR bp = breakpoint; bp ; bp = bp->next) { 250 for(BPTR bp = breakpoint; bp ; bp = bp->next) {
244 #ifdef USE_MMU 251 #ifdef USE_MMU
245 printf("0x%x p=0x%x c=%d w=0x%x\n", bp->laddr, bp->address, bp->count, bp->watch); 252 printf("0x%x p=0x%x c=%d w=0x%x\n", bp->laddr, bp->address, bp->count, bp->watch);
246 #else 253 #else
289 } 296 }
290 } 297 }
291 if (next[0]) { 298 if (next[0]) {
292 adr = getarg(next,&next); 299 adr = getarg(next,&next);
293 #ifdef USE_MMU 300 #ifdef USE_MMU
294 adr -= adr &0xf; 301 if (d!='i') // disassembler may fail on page boundary
295 // if (p=='p') adr -= adr&0x1fff; 302 adr -= adr &0xf;
296 #endif 303 #endif
297 if (next[0]) { 304 if (next[0]) {
298 len = getarg(next,&next); 305 len = getarg(next,&next);
299 } 306 }
300 } 307 }
430 } 437 }
431 438
432 /* 439 /*
433 * keep break point / watch point in a list 440 * keep break point / watch point in a list
434 */ 441 */
435 void setbreak(int adr, int count) { 442 void setbreak(int adr, int count, int page) {
436 BPTR bp = calloc(1,sizeof(BP)); 443 BPTR bp = calloc(1,sizeof(BP));
437 bp->count = count; 444 bp->count = count;
438 bp->laddr = adr; 445 bp->laddr = adr;
439 bp->address = paddr(adr,mmu); 446 bp->address = paddr(adr,mmu);
440 #ifdef USE_MMU 447 #ifdef USE_MMU
448 if (page!=-1) {
449 bp->address = page*0x2000 + adr;
450 }
441 if (bp->address >= memsize) { free(bp); return; } 451 if (bp->address >= memsize) { free(bp); return; }
442 bp->watch = *mem0(phymem,adr,mmu); 452 bp->watch = phymem[bp->address];
443 #else 453 #else
444 bp->watch = mem[adr]; 454 bp->watch = mem[adr];
445 #endif 455 #endif
446 bp->next = breakpoint; 456 bp->next = breakpoint;
447 breakpoint = bp; 457 breakpoint = bp;
498 ofs = 2; break; 508 ofs = 2; break;
499 } 509 }
500 } 510 }
501 break; 511 break;
502 } 512 }
503 if (ofs) setbreak(pcreg+ofs,-1); 513 if (ofs) setbreak(pcreg+ofs,-1,-1);
504 return ofs; 514 return ofs;
505 } 515 }
506 516
507 /* end */ 517 /* end */