src/hg/lib/web.c 1.162
1.162 2009/06/03 04:30:19 markd
don't dumps stacks on find errors; doing stack dump in abort handler rather than warn handler simplifies
Index: src/hg/lib/web.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/web.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -b -B -U 4 -r1.161 -r1.162
--- src/hg/lib/web.c 3 Jun 2009 00:34:09 -0000 1.161
+++ src/hg/lib/web.c 3 Jun 2009 04:30:19 -0000 1.162
@@ -30,24 +30,21 @@
/* global: a cart for use in error handlers. */
static struct cart *errCart = NULL;
-static boolean stackWarnHasBeenDone = FALSE; // prevent accidental recursion, only allow once
+static boolean stackDumpHasBeenDone = FALSE; // prevent accidental recursion, only allow once
-static void webDumpStackWarnHandler(char *format, va_list args)
-/* warn handle that generates a warning and then invokes the previous error
+static void webDumpStackAbortHandler()
+/* abort handle that prints stack dump then invokes the previous abort
* handler on the stack. */
{
-if (!stackWarnHasBeenDone)
+if (!stackDumpHasBeenDone)
{
- stackWarnHasBeenDone = TRUE;
+ stackDumpHasBeenDone = TRUE;
popWarnHandler(); // remove us from the stack
- va_list localArgs;
- va_copy(localArgs, args);
- vaDumpStack(format, localArgs);
- va_end(localArgs);
- // continue with next warn handler
- vaWarn(format, args);
+ dumpStack("Stack dump:");
+ // continue with next abort handler
+ noWarnAbort();
}
}
boolean webDumpStackEnabled(void)
@@ -55,19 +52,27 @@
{
return cfgOptionBooleanDefault("browser.dumpStack", FALSE);
}
-void webPushDumpStackHandler(void)
+void webDumpStackDisallow(void)
+/* prevent any dumping of the stack */
+{
+stackDumpHasBeenDone = TRUE;
+}
+
+void webDumpStackPushAbortHandler(void)
+/* push the stack dump abort handler on the stack if it's enabled. This should be pushed
+ * after the warn handle that will do the actual reporting */
{
if (webDumpStackEnabled())
- pushWarnHandler(webDumpStackWarnHandler);
+ pushAbortHandler(webDumpStackAbortHandler);
}
-void webPopDumpStackHandler(void)
-/* pop the stack dump handler from the stack if it's enabled */
+void webDumpStackPopAbortHandler(void)
+/* pop the stack dump abort handler from the stack if it's enabled */
{
-if (webDumpStackEnabled() && !stackWarnHasBeenDone)
- popWarnHandler();
+if (webDumpStackEnabled() && !stackDumpHasBeenDone)
+ popAbortHandler();
}
void textVaWarn(char *format, va_list args)
{
@@ -86,9 +91,9 @@
if (webInTextMode)
pushWarnHandler(textVaWarn);
else
pushWarnHandler(webVaWarn);
-webPushDumpStackHandler();
+webDumpStackPushAbortHandler();
pushAbortHandler(softAbort);
}
void webPushErrHandlersCart(struct cart *cart)
@@ -101,9 +106,9 @@
void webPopErrHandlers(void)
/* Pop warn and abort handler for errAbort(). */
{
popWarnHandler();
-webPopDumpStackHandler();
+webDumpStackPopAbortHandler();
popAbortHandler();
}
void webSetStyle(char *style)