diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-09-11 20:50:12 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-09-11 20:50:12 +0200 |
commit | 2845d26a60ab9f94981521c89bce33a2bea3e937 (patch) | |
tree | 4ad12acb69640851eafc4362a59b05c5545ed5a4 | |
parent | 25d5ceed31dd5e9256ebb4479397bfb5eed78155 (diff) |
Fix exploring stack trace up to assembly
* i386/i386/db_trace.c (db_i386_stack_trace): Do not stop as soon as frame
is 0, lookup PC first, and stop only before accessing the frame content.
-rw-r--r-- | i386/i386/db_trace.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/i386/i386/db_trace.c b/i386/i386/db_trace.c index c8789e71..8f8197f1 100644 --- a/i386/i386/db_trace.c +++ b/i386/i386/db_trace.c @@ -431,7 +431,7 @@ db_i386_stack_trace( } lastframe = 0; - while (count-- && frame != 0) { + while (count--) { int narg; char * name; db_expr_t offset; @@ -459,9 +459,12 @@ db_i386_stack_trace( goto next_frame; } else { frame_type = 0; - narg = db_numargs(frame, task); + if (frame) + narg = db_numargs(frame, task); + else + narg = -1; } - } else if (INKERNEL(callpc) ^ INKERNEL(frame)) { + } else if (!frame || INKERNEL(callpc) ^ INKERNEL(frame)) { frame_type = 0; narg = -1; } else { @@ -477,6 +480,8 @@ db_i386_stack_trace( } else db_printf("%s(", name); + if (!frame) + break; argp = &frame->f_arg0; while (narg > 0) { db_printf("%x", db_get_task_value((long)argp,sizeof(long),FALSE,task)); @@ -501,10 +506,6 @@ db_i386_stack_trace( next_frame: db_nextframe(&lastframe, &frame, &callpc, frame_type, th); - if (frame == 0) { - /* end of chain */ - break; - } if (!INKERNEL(lastframe) || (!INKERNEL(callpc) && !INKERNEL(frame))) user_frame++; |