Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-88226: Emit TARGET labels in Python/ceval.c when debugging, even if computed gotos aren't enabled #98265

Merged
merged 34 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6b8f9c2
keep target labels when debugging, but don't warn about lack of use
smontanaro Oct 14, 2022
3abeec3
NEWS blurb
smontanaro Oct 14, 2022
5194f57
Merge branch 'main' into gh-25949
smontanaro Oct 14, 2022
4071c27
get the issue number right
smontanaro Oct 16, 2022
c15aa69
Merge remote-tracking branch 'origin/main' into gh-25949
smontanaro Oct 16, 2022
61e5021
Merge remote-tracking branch 'origin/gh-25949' into gh-25949
smontanaro Oct 16, 2022
08a58fe
Merge branch 'main' into gh-25949
smontanaro Oct 16, 2022
8c48884
Merge branch 'main' into gh-25949
smontanaro Oct 17, 2022
dc899f7
Merge branch 'main' into gh-25949
smontanaro Oct 17, 2022
8abe801
Merge branch 'main' into gh-25949
smontanaro Oct 18, 2022
cdfbe7b
Merge branch 'main' into gh-25949
smontanaro Oct 18, 2022
a56d52c
Merge branch 'main' into gh-25949
smontanaro Oct 19, 2022
1f74101
Merge branch 'main' into gh-25949
smontanaro Oct 19, 2022
cafe4f4
Merge branch 'main' into gh-25949
smontanaro Oct 20, 2022
e7ec54e
Merge branch 'main' into gh-25949
smontanaro Oct 21, 2022
8d5661b
Merge branch 'main' into gh-25949
smontanaro Oct 21, 2022
ec1f2fe
Merge branch 'main' into gh-25949
smontanaro Nov 1, 2022
8fec43c
Merge branch 'main' into gh-25949
smontanaro Nov 1, 2022
13bd5fa
keep target labels when debugging, but don't warn about lack of use
smontanaro Oct 14, 2022
f023acc
NEWS blurb
smontanaro Oct 14, 2022
cb638e3
get the issue number right
smontanaro Oct 16, 2022
dd24ca3
Merge branch 'main' into gh-25949
smontanaro Nov 2, 2022
c76b9cd
more fine-grained warning suppression
smontanaro Nov 3, 2022
564aeff
bike shedding
smontanaro Nov 3, 2022
5109f78
Merge branch 'main' into gh-25949
smontanaro Nov 3, 2022
b1bbe02
Merge remote-tracking branch 'upstream/main' into gh-25949
smontanaro Nov 3, 2022
9507fb7
Merge remote-tracking branch 'origin/gh-25949' into gh-25949
smontanaro Nov 3, 2022
5cfe3aa
Apply suggestions from code review
smontanaro Nov 3, 2022
9fcc606
Merge branch 'main' into gh-25949
smontanaro Nov 3, 2022
bf13503
how did these sneak back in?
smontanaro Nov 4, 2022
5cc4aa4
Merge branch 'main' into gh-25949
smontanaro Nov 20, 2022
b174735
Merge branch 'main' into gh-25949
smontanaro Nov 22, 2022
c0bf1f1
Merge branch 'main' into gh-25949
smontanaro Nov 22, 2022
0d0a9de
Merge branch 'main' into gh-25949
smontanaro Nov 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Always define ``TARGET_*`` labels in ``Python/ceval.c``, even if
``USE_COMPUTED_GOTOS`` is disabled. This allows breakpoints to be
set at those labels in (for instance) ``gdb``.
25 changes: 21 additions & 4 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,11 +678,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
#endif

#if USE_COMPUTED_GOTOS
#define TARGET(op) TARGET_##op: INSTRUCTION_START(op);
#define DISPATCH_GOTO() goto *opcode_targets[opcode]
# define TARGET(op) TARGET_##op: INSTRUCTION_START(op);
# define DISPATCH_GOTO() goto *opcode_targets[opcode]
#else
#define TARGET(op) case op: INSTRUCTION_START(op);
#define DISPATCH_GOTO() goto dispatch_opcode
# define TARGET(op) case op: TARGET_##op: INSTRUCTION_START(op);
# define DISPATCH_GOTO() goto dispatch_opcode
#endif

/* PRE_DISPATCH_GOTO() does lltrace if enabled. Normally a no-op */
Expand Down Expand Up @@ -1056,6 +1056,18 @@ static inline void _Py_LeaveRecursiveCallPy(PyThreadState *tstate) {
#define KWNAMES_LEN() \
(kwnames == NULL ? 0 : ((int)PyTuple_GET_SIZE(kwnames)))

/* Disable unused label warnings. They are handy for debugging, even
if computed gotos aren't used. */

/* TBD - what about other compilers? */
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-label"
#elif defined(_MSC_VER) /* MS_WINDOWS */
# pragma warning(push)
# pragma warning(disable:4102)
#endif

PyObject* _Py_HOT_FUNCTION
_PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
{
Expand Down Expand Up @@ -1435,6 +1447,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
goto error;

}
#if defined(__GNUC__)
# pragma GCC diagnostic pop
#elif defined(_MSC_VER) /* MS_WINDOWS */
# pragma warning(pop)
#endif

static void
format_missing(PyThreadState *tstate, const char *kind,
Expand Down