summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2005-04-16 05:38:59 +0000
committermarcel <marcel@FreeBSD.org>2005-04-16 05:38:59 +0000
commit517573844397fe147b96449c7be39e1ca13359d5 (patch)
treea971d68f5dfaed7fec42643df58daab10670c21f
parent8d7ad964f1ebe7d4f248eeca3516359677c50b4e (diff)
downloadFreeBSD-src-517573844397fe147b96449c7be39e1ca13359d5.zip
FreeBSD-src-517573844397fe147b96449c7be39e1ca13359d5.tar.gz
Return better "error" values for UWX_BOTTOM and UWX_ABI_FRAME in
unw_step(). Both errors denote the end of a stack trace (i.e. no prior frame), but are otherwise not error conditions. Have db_trace() return 0 when the trace ends due to one of these return codes as they are really normal termination conditions. This change especially improves the output of the "show thread" command in DDB when there are threads in fork_trampoline() and previously db_trace() would return an error, causing the show command to emit '***'.
-rw-r--r--sys/ia64/ia64/db_trace.c8
-rw-r--r--sys/ia64/ia64/unwind.c19
2 files changed, 21 insertions, 6 deletions
diff --git a/sys/ia64/ia64/db_trace.c b/sys/ia64/ia64/db_trace.c
index f90e0e9..1dae4da 100644
--- a/sys/ia64/ia64/db_trace.c
+++ b/sys/ia64/ia64/db_trace.c
@@ -106,7 +106,7 @@ db_backtrace(struct thread *td, struct pcb *pcb, int count)
db_printsym(ip, DB_STGY_PROC);
db_printf("\n");
- if (error != EOVERFLOW)
+ if (error != ERESTART)
continue;
if (sp < IA64_RR_BASE(5))
break;
@@ -123,7 +123,11 @@ db_backtrace(struct thread *td, struct pcb *pcb, int count)
}
unw_delete(&rs);
- return (error);
+ /*
+ * EJUSTRETURN and ERESTART signal the end of a trace and
+ * are not really errors.
+ */
+ return ((error > 0) ? error : 0);
}
void
diff --git a/sys/ia64/ia64/unwind.c b/sys/ia64/ia64/unwind.c
index 69a3fa2..6343ed8 100644
--- a/sys/ia64/ia64/unwind.c
+++ b/sys/ia64/ia64/unwind.c
@@ -380,10 +380,21 @@ unw_step(struct unw_regstate *rs)
{
int err;
- err = uwx_step(rs->env);
- if (err == UWX_ABI_FRAME)
- return (EOVERFLOW);
- return ((err != 0) ? EINVAL : 0); /* XXX */
+ switch (uwx_step(rs->env)) {
+ case UWX_ABI_FRAME:
+ err = ERESTART;
+ break;
+ case UWX_BOTTOM:
+ err = EJUSTRETURN;
+ break;
+ case UWX_OK:
+ err = 0;
+ break;
+ default:
+ err = EINVAL; /* XXX */
+ break;
+ }
+ return (err);
}
int
OpenPOWER on IntegriCloud