nemu: fix some memory bug
All checks were successful
Build abstract machine with nix / build-abstract-machine (push) Successful in 8m7s
All checks were successful
Build abstract machine with nix / build-abstract-machine (push) Successful in 8m7s
This commit is contained in:
parent
b02b1d2e37
commit
2209c26dce
3 changed files with 6 additions and 6 deletions
|
@ -180,12 +180,12 @@ config MTRACE_RANGE_MAX
|
||||||
config FTRACE
|
config FTRACE
|
||||||
depends on TRACE && TARGET_NATIVE_ELF && ENGINE_INTERPRETER
|
depends on TRACE && TARGET_NATIVE_ELF && ENGINE_INTERPRETER
|
||||||
bool "Enable function tracing"
|
bool "Enable function tracing"
|
||||||
default y
|
default n
|
||||||
|
|
||||||
config FTRACE_STACK_SIZE
|
config FTRACE_STACK_SIZE
|
||||||
depends on FTRACE
|
depends on FTRACE
|
||||||
int "Max function track stack size"
|
int "Max function track stack size"
|
||||||
default 100
|
default 256
|
||||||
|
|
||||||
config FTRACE_LOG
|
config FTRACE_LOG
|
||||||
depends on FTRACE
|
depends on FTRACE
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void exec_once(Decode *s, vaddr_t pc) {
|
||||||
#ifdef CONFIG_ITRACE
|
#ifdef CONFIG_ITRACE
|
||||||
logbuf_rear = (logbuf_rear + 1) % CONFIG_ITRACE_BUFFER;
|
logbuf_rear = (logbuf_rear + 1) % CONFIG_ITRACE_BUFFER;
|
||||||
char *p = logbuf[logbuf_rear];
|
char *p = logbuf[logbuf_rear];
|
||||||
p += snprintf(p, sizeof(logbuf), FMT_WORD ":", s->pc);
|
p += snprintf(p, sizeof(logbuf[logbuf_rear]), FMT_WORD ":", s->pc);
|
||||||
int ilen = s->snpc - s->pc;
|
int ilen = s->snpc - s->pc;
|
||||||
int i;
|
int i;
|
||||||
uint8_t *inst = (uint8_t *)&s->isa.inst.val;
|
uint8_t *inst = (uint8_t *)&s->isa.inst.val;
|
||||||
|
|
|
@ -104,7 +104,7 @@ void ftrace_call(vaddr_t pc, vaddr_t addr) {
|
||||||
"FTRACE_STACK_SIZE.");
|
"FTRACE_STACK_SIZE.");
|
||||||
ftrace_stack[ftrace_stack_len] = pc + 4;
|
ftrace_stack[ftrace_stack_len] = pc + 4;
|
||||||
Trace("%*s0x%x call 0x%x <%s+0x%x>", ftrace_stack_len, "", pc, addr,
|
Trace("%*s0x%x call 0x%x <%s+0x%x>", ftrace_stack_len, "", pc, addr,
|
||||||
f == NULL ? "???" : f->name, addr - f->start);
|
f == NULL ? "???" : f->name, f == NULL ? addr : addr - f->start);
|
||||||
ftrace_stack_len++;
|
ftrace_stack_len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,10 +115,10 @@ void ftrace_return(vaddr_t pc, vaddr_t addr) {
|
||||||
vaddr_t tco_addr = ftrace_stack[ftrace_stack_len];
|
vaddr_t tco_addr = ftrace_stack[ftrace_stack_len];
|
||||||
func_t *f = get_func(tco_addr);
|
func_t *f = get_func(tco_addr);
|
||||||
Trace("%*s0x%x ret 0x%x <%s+0x%x> (TCO)", ftrace_stack_len, "", pc, tco_addr,
|
Trace("%*s0x%x ret 0x%x <%s+0x%x> (TCO)", ftrace_stack_len, "", pc, tco_addr,
|
||||||
f == NULL ? "???" : f->name, tco_addr - f->start);
|
f == NULL ? "???" : f->name, f == NULL ? addr : addr - f->start);
|
||||||
}
|
}
|
||||||
func_t *f = get_func(addr);
|
func_t *f = get_func(addr);
|
||||||
Trace("%*s0x%x ret 0x%x <%s+0x%x>", ftrace_stack_len, "", pc, addr,
|
Trace("%*s0x%x ret 0x%x <%s+0x%x>", ftrace_stack_len, "", pc, addr,
|
||||||
f == NULL ? "???" : f->name, addr - f->start);
|
f == NULL ? "???" : f->name, f == NULL ? addr : addr - f->start);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue