trace_ctx.ksym_table->ksym_label_off + sym->label_off);
}
+static inline bool valid_fp(ptr_t ptr) {
+ return KERNEL_STACK < ptr && ptr < KERNEL_EXEC_END;
+}
+
int
trace_walkback(struct trace_record* tb_buffer,
ptr_t fp,
struct ksym_entry* current = NULL;
int i = 0;
- while (frame && i < limit) {
+ while (valid_fp((ptr_t)frame) && i < limit) {
ptr_t pc = *(frame + 1);
current = trace_sym_lookup(pc);
i++;
}
+ if (!valid_fp((ptr_t)frame)) {
+ frame = NULL;
+ }
+
if (last_fp) {
*last_fp = (ptr_t)frame;
}
p->execp->vector,
p->execp->err_code);
- trace_print_code_entry(sym->pc, p->execp->eip, ksym_getstr(sym));
+ ptr_t sym_pc = sym ? sym->pc : p->execp->eip;
+ trace_print_code_entry(sym_pc, p->execp->eip, ksym_getstr(sym));
}
void