Skip to content

Commit 0be1562

Browse files
committed
Add extra check.
1 parent 5faec77 commit 0be1562

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Python/instrumentation.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "pycore_pystate.h"
1212

1313
/* Uncomment this to dump debugging output when assertions fail */
14-
// #define INSTRUMENT_DEBUG 1
14+
#define INSTRUMENT_DEBUG 1
1515

1616
static PyObject DISABLE =
1717
{
@@ -401,7 +401,6 @@ dump_instrumentation_data(PyCodeObject *code, int star, FILE*out)
401401
dump_instrumentation_data_lines(code, data->lines, i, out);
402402
dump_instrumentation_data_line_tools(code, data->line_tools, i, out);
403403
dump_instrumentation_data_per_instruction(code, data, i, out);
404-
/* TO DO -- per instruction data */
405404
fprintf(out, "\n");
406405
;
407406
}
@@ -462,7 +461,10 @@ sanity_check_instrumentation(PyCodeObject *code)
462461
if (!is_instrumented(opcode)) {
463462
CHECK(_PyOpcode_Deopt[opcode] == opcode);
464463
}
465-
/* TO DO -- check tools */
464+
if (data->per_instruction_tools) {
465+
uint8_t tools = active_monitors.tools[PY_MONITORING_EVENT_INSTRUCTION];
466+
CHECK((tools & data->per_instruction_tools[i]) == data->per_instruction_tools[i]);
467+
}
466468
}
467469
if (opcode == INSTRUMENTED_LINE) {
468470
CHECK(data->lines);
@@ -498,7 +500,7 @@ sanity_check_instrumentation(PyCodeObject *code)
498500
CHECK(valid_opcode(opcode));
499501
if (data->tools) {
500502
uint8_t local_tools = data->tools[i];
501-
if (OPCODE_HAS_EVENT[base_opcode]) {
503+
if (opcode_has_event(base_opcode)) {
502504
int event = EVENT_FOR_OPCODE[base_opcode];
503505
if (event == -1) {
504506
/* RESUME fixup */

0 commit comments

Comments
 (0)