Line 291... |
Line 291... |
struct dyn_page *dp;
|
struct dyn_page *dp;
|
FILE *f;
|
FILE *f;
|
char filen[18]; /* 18 == strlen("or_page.%08x") + 1 */
|
char filen[18]; /* 18 == strlen("or_page.%08x") + 1 */
|
void *stack;
|
void *stack;
|
int i, j;
|
int i, j;
|
void *trace[10];
|
void *trace[11];
|
int num_trace;
|
int num_trace;
|
char **trace_names;
|
char **trace_names;
|
|
struct sigcontext *sigc = dat;
|
|
|
if(!sigsegv_state) {
|
if(!sigsegv_state) {
|
sigsegv_addr = siginf->si_addr;
|
sigsegv_addr = siginf->si_addr;
|
} else {
|
} else {
|
fprintf(stderr, "Nested SIGSEGV occured, dumping next chuck of info\n");
|
fprintf(stderr, "Nested SIGSEGV occured, dumping next chuck of info\n");
|
Line 306... |
Line 307... |
|
|
/* First dump all the data that does not need dereferenceing to get */
|
/* First dump all the data that does not need dereferenceing to get */
|
switch(sigsegv_state) {
|
switch(sigsegv_state) {
|
case 0:
|
case 0:
|
fflush(stderr);
|
fflush(stderr);
|
fprintf(stderr, "Segmentation fault on acces to %p (or address: 0x%"PRIxADDR")\n\n",
|
fprintf(stderr, "Segmentation fault on acces to %p at 0x%08lx, (or address: 0x%"PRIxADDR")\n\n",
|
sigsegv_addr, get_pc());
|
sigsegv_addr, sigc->eip, get_pc());
|
sigsegv_state++;
|
sigsegv_state++;
|
case 1:
|
case 1:
|
/* Run through the recompiled pages, dumping them to disk as we go */
|
/* Run through the recompiled pages, dumping them to disk as we go */
|
for(dp = cpu_state.dyn_pages; dp; dp = dp->next) {
|
for(dp = cpu_state.dyn_pages; dp; dp = dp->next) {
|
fprintf(stderr, "Dumping%s page 0x%"PRIxADDR" recompiled to %p (len: %u) to disk\n",
|
fprintf(stderr, "Dumping%s page 0x%"PRIxADDR" recompiled to %p (len: %u) to disk\n",
|
Line 337... |
Line 338... |
fprintf(stderr, "Stack dump: ");
|
fprintf(stderr, "Stack dump: ");
|
fflush(stderr);
|
fflush(stderr);
|
|
|
num_trace = backtrace(trace, 10);
|
num_trace = backtrace(trace, 10);
|
|
|
|
trace[num_trace++] = (void *)sigc->eip;
|
trace_names = backtrace_symbols(trace, num_trace);
|
trace_names = backtrace_symbols(trace, num_trace);
|
|
|
stack = get_sp();
|
stack = get_sp();
|
fprintf(stderr, "(of stack at %p, base: %p)\n", stack, rec_stack_base);
|
fprintf(stderr, "(of stack at %p, base: %p)\n", stack, rec_stack_base);
|
fflush(stderr);
|
fflush(stderr);
|
Line 352... |
Line 354... |
fprintf(stderr, " <%s>", trace_names[j]);
|
fprintf(stderr, " <%s>", trace_names[j]);
|
}
|
}
|
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
fflush(stderr);
|
fflush(stderr);
|
}
|
}
|
|
fprintf(stderr, "Fault at: 0x%08lx <%s>\n", sigc->eip,
|
|
trace_names[num_trace - 1]);
|
sigsegv_state++;
|
sigsegv_state++;
|
case 3:
|
case 3:
|
sim_done();
|
sim_done();
|
}
|
}
|
}
|
}
|