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
|
||||
depends on TRACE && TARGET_NATIVE_ELF && ENGINE_INTERPRETER
|
||||
bool "Enable function tracing"
|
||||
default y
|
||||
default n
|
||||
|
||||
config FTRACE_STACK_SIZE
|
||||
depends on FTRACE
|
||||
int "Max function track stack size"
|
||||
default 100
|
||||
default 256
|
||||
|
||||
config FTRACE_LOG
|
||||
depends on FTRACE
|
||||
|
|
|
@ -52,7 +52,7 @@ static void exec_once(Decode *s, vaddr_t pc) {
|
|||
#ifdef CONFIG_ITRACE
|
||||
logbuf_rear = (logbuf_rear + 1) % CONFIG_ITRACE_BUFFER;
|
||||
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 i;
|
||||
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[ftrace_stack_len] = pc + 4;
|
||||
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++;
|
||||
}
|
||||
|
||||
|
@ -115,10 +115,10 @@ void ftrace_return(vaddr_t pc, vaddr_t addr) {
|
|||
vaddr_t tco_addr = ftrace_stack[ftrace_stack_len];
|
||||
func_t *f = get_func(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);
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue