Mercurial > hg > Members > kono > os9 > sbc09
diff trace.c @ 35:01519215ec70
add watch point
0xfe00 fixed ram area in MMU
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Jul 2018 20:29:55 +0900 |
parents | 7c5379eb406e |
children | 52f7ad4c2ebb |
line wrap: on
line diff
--- a/trace.c Sun Jul 15 14:18:19 2018 +0900 +++ b/trace.c Sun Jul 15 20:29:55 2018 +0900 @@ -58,6 +58,7 @@ int address; // physical address int laddr; int count; + int watch; // watch point struct bp *next; } BP, *BPTR; @@ -67,7 +68,23 @@ int stkskip = 0; int getarg(char *buf, char** next) { - return strtol(buf,(char**)next,0); + int value = strtol(buf,next,0); + for(;next;) { + if ( **next == '+' ) { + value += strtol(*next+1,next,0); + } else if ( **next == '*' ) { + value *= strtol(*next+1,next,0); + } else if ( **next == '/' ) { + value /= strtol(*next+1,next,0); + } else if ( **next == '-' ) { + value -= strtol(*next+1,next,0); + } else if ( **next == '&' ) { + value &= strtol(*next+1,next,0); + } else if ( **next == '|' ) { + value |= strtol(*next+1,next,0); + } else break; + } + return value; } void printhelp(void) @@ -110,7 +127,13 @@ int ppc = paddr(pcreg,mmu); BPTR *prev = &breakpoint; for(BPTR b = breakpoint; b ; prev=&b->next, b=b->next ) { - if (ppc==b->address /* || pcreg==b->laddr */) { +#ifdef USE_MMU + int watch = phymem[b->address]; +#else + int watch = mem[b->address]; +#endif + if (ppc==b->address || b->watch != watch ) { + b->watch = watch; if (b->count==-1) { // temporaly break point BPTR next = b->next; free(b); @@ -138,6 +161,7 @@ do_trace(stdout); if (trskip>1) { // show trace and step trskip--; + int watch; // watch point set_term(escchar); return; } @@ -181,9 +205,9 @@ case 'B': // break point list for(BPTR bp = breakpoint; bp ; bp = bp->next) { #ifdef USE_MMU - printf("%x %x %d\n", bp->laddr, bp->address, bp->count); + printf("0x%x p=0x%x c=%d w=0x%x\n", bp->laddr, bp->address, bp->count, bp->watch); #else - printf("%x %d\n", bp->address, bp->count); + printf("0x%x c=%d w=0x%x\n", bp->address, bp->count,bp->watch); #endif } goto restart; @@ -360,6 +384,11 @@ bp->count = count; bp->laddr = adr; bp->address = paddr(adr,mmu); +#ifdef USE_MMU + bp->watch = *mem0(phymem,adr,mmu); +#else + bp->watch = mem[adr]; +#endif } int nexti(void) {