[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small patch for MiNT



Hello everybody!

When develloping software, I often noticed after program crashes that
the output to the console or to the alert pipe was not sufficient to find
the position of the crash. So I wrote this small patch that gives some
more information about the program (addresses of the text, data and bss
segment), so it is even possible to find the crash position in a shared
text program...

ok, here it comes:

--- old\signal.c	Fri Apr  1 15:08:44 1994
+++ signal.c	Fri Apr  1 15:15:22 1994
@@ -214,11 +214,24 @@
 	else if (signames[sig]) {
 		if (!no_mem_prot && sig == SIGBUS) {
 		    /* already reported by report_buserr */
 		} else {
-			ALERT("%s: User PC=%lx (basepage=%lx)",
+			/* uk: give some more information in case of a crash, so that a
+			 *     progam which shared text can be debugged better.
+			 */
+			BASEPAGE *base;
+			long ptext = 0, pdata = 0, pbss = 0;
+
+			base = curproc->base;
+			if (base)   /* can it happen, that base == NULL???? */
+			{
+				ptext = base->p_tbase;
+				pdata = base->p_dbase;
+				pbss = base->p_bbase;
+			}
+			ALERT("%s: User PC=%lx (basepage=%lx, text=%lx, data=%lx, bss=%lx)",
 				signames[sig],
-				curproc->exception_pc, curproc->base);
+				curproc->exception_pc, curproc->base, ptext, pdata, pbss);
 		}
 /* save the processor state at crash time */
 /* assumes that "crash time" is the context curproc->ctxt[SYSCALL] */
 /* BUG: this is not true if the crash happened in the kernel; in the


ok, I hope this will help someone,

Have fun,
Ulrich
--
+---------------+----------------------------+-----------------------+
| Ulrich Kuehn  | Internet:                  | Life is uncertain --  |
| Cand.Math.Inf | kuehn@math.uni-muenster.de | eat the dessert first |
+---------------+----------------------------+-----------------------+