Index: trunk/ippTools/src/stacktool.c
===================================================================
--- trunk/ippTools/src/stacktool.c	(revision 41297)
+++ trunk/ippTools/src/stacktool.c	(revision 42097)
@@ -264,4 +264,10 @@
     pxAddLabelSearchArgs (config, where, "-warp_id",                   "warpRun.warp_id", "==");
     
+    // Add position dependence here.
+    if (!pxspaceBoxAddWhere(config, where)) {
+      psError(psErrorCodeLast(), false, "pxSpaceBoxAddWhere failed");
+      return false;
+    }
+  
     // these are used to build the HAVING restriction
     PXOPT_COPY_S32(config->args, having, "-min_num", "num_warp", ">=");
@@ -922,6 +928,7 @@
     PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
-
-    psString query = pxDataGet("stacktool_tosum.sql");
+    PXOPT_LOOKUP_BOOL(ignore_warp_state, config->args, "-ignore-warp-state", false);
+
+    psString query = ignore_warp_state ? pxDataGet("stacktool_tosum_allstates.sql") : pxDataGet("stacktool_tosum.sql");
     if (!query) {
         psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
