]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add some debugging features if DEBUG defined
authorGuido van Rossum <guido@python.org>
Thu, 3 Sep 1992 20:29:45 +0000 (20:29 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 3 Sep 1992 20:29:45 +0000 (20:29 +0000)
(fetch the filename as a string so I can see it with dbx, and set f_lineno);
call abort() when detecting an "undetected" error.

Python/ceval.c

index 72f5eb14cfa95b64f044f43b798f92ac0854933b..469068e11dfc1c15d723e62b8023095a01705d06 100644 (file)
@@ -180,6 +180,10 @@ eval_code(co, globals, locals, arg)
 #ifdef LLTRACE
        int lltrace = dictlookup(globals, "__lltrace__") != NULL;
 #endif
+#ifdef DEBUG
+       /* Make it easier to find out where we are with dbx */
+       char *filename = getstringvalue(co->co_filename);
+#endif
 
 /* Code access macros */
 
@@ -296,6 +300,10 @@ eval_code(co, globals, locals, arg)
                }
 
                /* Extract opcode and argument */
+
+#ifdef DEBUG
+               f->f_lasti = INSTR_OFFSET();
+#endif
                
                opcode = NEXTOP();
                if (HAS_ARG(opcode))
@@ -1137,6 +1145,8 @@ eval_code(co, globals, locals, arg)
                else {
                        if (err_occurred()) {
                                fprintf(stderr, "XXX undetected error\n");
+                               abort();
+                               /* NOTREACHED */
                                why = WHY_EXCEPTION;
                        }
                }