Skip to content

Commit

Permalink
pythongh-127627: Add posix._emscripten_debugger function (python#12…
Browse files Browse the repository at this point in the history
…7628)

Add a posix._emscripten_debugger function to add an emscripten breakpoint.
  • Loading branch information
hoodmane authored Dec 6, 2024
1 parent 8b3cccf commit 25eee57
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added ``posix._emscripten_debugger()`` to help with debugging the test suite on
the Emscripten target.
28 changes: 27 additions & 1 deletion Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
extern char * _getpty(int *, int, mode_t, int);
#endif

#ifdef __EMSCRIPTEN__
#include "emscripten.h" // emscripten_debugger()
#endif

/*
* A number of APIs are available on macOS from a certain macOS version.
Expand Down Expand Up @@ -16845,8 +16848,24 @@ os__create_environ_impl(PyObject *module)
}


static PyMethodDef posix_methods[] = {
#ifdef __EMSCRIPTEN__
/*[clinic input]
os._emscripten_debugger
Create a breakpoint for the JavaScript debugger. Emscripten only.
[clinic start generated code]*/

static PyObject *
os__emscripten_debugger_impl(PyObject *module)
/*[clinic end generated code: output=ad47dc3bf0661343 input=d814b1877fb6083a]*/
{
emscripten_debugger();
Py_RETURN_NONE;
}
#endif /* __EMSCRIPTEN__ */


static PyMethodDef posix_methods[] = {
OS_STAT_METHODDEF
OS_ACCESS_METHODDEF
OS_TTYNAME_METHODDEF
Expand Down Expand Up @@ -17060,6 +17079,7 @@ static PyMethodDef posix_methods[] = {
OS__INPUTHOOK_METHODDEF
OS__IS_INPUTHOOK_INSTALLED_METHODDEF
OS__CREATE_ENVIRON_METHODDEF
OS__EMSCRIPTEN_DEBUGGER_METHODDEF
{NULL, NULL} /* Sentinel */
};

Expand Down

0 comments on commit 25eee57

Please sign in to comment.