Skip to content

Commit

Permalink
debug: incidental debug improvements in tracer.c
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed May 12, 2022
1 parent 45ba7e7 commit 9097c0d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions coverage/ctracer/tracer.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ CTracer_dealloc(CTracer *self)
}

#if TRACE_LOG
/* Set debugging constants: a file substring and line number to start logging. */
static const char * start_file = "badasync.py";
static int start_line = 1;

static const char *
indent(int n)
{
Expand All @@ -132,9 +136,6 @@ indent(int n)
}

static BOOL logging = FALSE;
/* Set these constants to be a file substring and line number to start logging. */
static const char * start_file = "nested.py";
static int start_line = 1;

static void
CTracer_showlog(CTracer * self, int lineno, PyObject * filename, const char * msg)
Expand Down Expand Up @@ -787,11 +788,13 @@ CTracer_trace(CTracer *self, PyFrameObject *frame, int what, PyObject *arg_unuse
#endif

#if WHAT_LOG
const char * w = "XXX ";
if (what <= (int)(sizeof(what_sym)/sizeof(const char *))) {
ascii = PyUnicode_AsASCIIString(MyFrame_GetCode(frame)->co_filename);
printf("%x trace: f:%x %s @ %s %d\n", (int)self, (int)frame, what_sym[what], PyBytes_AS_STRING(ascii), PyFrame_GetLineNumber(frame));
Py_DECREF(ascii);
w = what_sym[what];
}
ascii = PyUnicode_AsASCIIString(MyFrame_GetCode(frame)->co_filename);
printf("%x trace: f:%x %s @ %s %d\n", (int)self, (int)frame, what_sym[what], PyBytes_AS_STRING(ascii), PyFrame_GetLineNumber(frame));
Py_DECREF(ascii);
#endif

#if TRACE_LOG
Expand Down

0 comments on commit 9097c0d

Please sign in to comment.