comparison src/trace.c @ 59:7c6dc25c2b05

add comment
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 23 Jul 2018 20:17:12 +0900
parents 2088fd998865
children 41f14f365b34
comparison
equal deleted inserted replaced
58:efbe39fee3ae 59:7c6dc25c2b05
1 /* 6808 Simulator V092 1 /* 6808 Simulator V092
2 * 2 *
3 * 2018 Shinji KONO
3 * tracer 4 * tracer
4 5 *
5 */ 6 */
6 7
7 #include<stdio.h> 8 #include<stdio.h>
8 #include<stdlib.h> 9 #include<stdlib.h>
9 #include<ctype.h> 10 #include<ctype.h>
237 attention = escape = 1; 238 attention = escape = 1;
238 if (s[1]) { 239 if (s[1]) {
239 bpskip = getarg(s+1,0); 240 bpskip = getarg(s+1,0);
240 } 241 }
241 break; 242 break;
243 /*
244 * we should have disassembler for a mmu page
245 */
242 case 'x': // dump 246 case 'x': // dump
243 { char *next = s+1; 247 { char *next = s+1;
244 if (s[1]=='i') next=s+2; 248 if (s[1]=='i') next=s+2;
245 else if (s[1]=='p') { 249 else if (s[1]=='p') {
246 next = s+2; 250 next = s+2;
374 #ifdef USE_MMU 378 #ifdef USE_MMU
375 mmu = &mem[0xffa0]; 379 mmu = &mem[0xffa0];
376 mem[0xffa7]=0x3f; 380 mem[0xffa7]=0x3f;
377 #endif 381 #endif
378 attention = escape = 1; 382 attention = escape = 1;
383 // we have to reload romfile
384 // readimage();
379 break; 385 break;
380 default: // one step trace 386 default: // one step trace
381 trskip = 1; 387 trskip = 1;
382 bpskip = 0; 388 bpskip = 0;
383 attention = escape = 1; 389 attention = escape = 1;
385 if (tracing||breakpoint||trskip||bpskip||stkskip) { attention = escape = 1; } 391 if (tracing||breakpoint||trskip||bpskip||stkskip) { attention = escape = 1; }
386 else attention = 0; 392 else attention = 0;
387 set_term(escchar); 393 set_term(escchar);
388 } 394 }
389 395
396 /*
397 * keep break point / watch point in a list
398 */
390 void setbreak(int adr, int count) { 399 void setbreak(int adr, int count) {
391 BPTR bp = calloc(1,sizeof(BP)); 400 BPTR bp = calloc(1,sizeof(BP));
392 bp->count = count; 401 bp->count = count;
393 bp->laddr = adr; 402 bp->laddr = adr;
394 bp->address = paddr(adr,mmu); 403 bp->address = paddr(adr,mmu);
400 #endif 409 #endif
401 bp->next = breakpoint; 410 bp->next = breakpoint;
402 breakpoint = bp; 411 breakpoint = bp;
403 } 412 }
404 413
414 /*
415 * length call instruction
416 *
417 * if call instruction, put temporary break on next instruction
418 * (ignoring page boundary, sorry)
419 */
405 int nexti(void) { 420 int nexti(void) {
406 #ifdef USE_MMU 421 #ifdef USE_MMU
407 int op1 = *mem0(phymem,pcreg,mmu); 422 int op1 = *mem0(phymem,pcreg,mmu);
408 int op2 = *mem0(phymem,pcreg+1,mmu); 423 int op2 = *mem0(phymem,pcreg+1,mmu);
409 #else 424 #else
451 } 466 }
452 if (ofs) setbreak(pcreg+ofs,-1); 467 if (ofs) setbreak(pcreg+ofs,-1);
453 return ofs; 468 return ofs;
454 } 469 }
455 470
456 471 /* end */
457
458
459
460
461
462