diff options
| author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2025-12-15 12:11:40 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-15 12:11:40 (GMT) |
| commit | 6658e2cb07fa2ebafb1476b258cbceb24e233708 (patch) | |
| tree | 2ff69bbf637dc15d5a91e2b7a015828b74350281 /Modules/_remote_debugging/_remote_debugging.h | |
| parent | 14e6052b438d99acaba7a39d454af98cfdf5cac7 (diff) | |
| download | cpython-6658e2cb07fa2ebafb1476b258cbceb24e233708.zip cpython-6658e2cb07fa2ebafb1476b258cbceb24e233708.tar.gz cpython-6658e2cb07fa2ebafb1476b258cbceb24e233708.tar.bz2 | |
gh-138122: Add --subprocesses flag to profile child processes in tachyon (#142636)
Diffstat (limited to 'Modules/_remote_debugging/_remote_debugging.h')
| -rw-r--r-- | Modules/_remote_debugging/_remote_debugging.h | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/Modules/_remote_debugging/_remote_debugging.h b/Modules/_remote_debugging/_remote_debugging.h index fcb75b8..2f3efed 100644 --- a/Modules/_remote_debugging/_remote_debugging.h +++ b/Modules/_remote_debugging/_remote_debugging.h @@ -8,23 +8,24 @@ #ifndef Py_REMOTE_DEBUGGING_H #define Py_REMOTE_DEBUGGING_H +/* _GNU_SOURCE must be defined before any system headers */ +#define _GNU_SOURCE + #ifdef __cplusplus extern "C" { #endif -#define _GNU_SOURCE - #ifndef Py_BUILD_CORE_BUILTIN # define Py_BUILD_CORE_MODULE 1 #endif #include "Python.h" -#include <internal/pycore_debug_offsets.h> // _Py_DebugOffsets -#include <internal/pycore_frame.h> // FRAME_SUSPENDED_YIELD_FROM -#include <internal/pycore_interpframe.h> // FRAME_OWNED_BY_INTERPRETER -#include <internal/pycore_llist.h> // struct llist_node -#include <internal/pycore_long.h> // _PyLong_GetZero -#include <internal/pycore_stackref.h> // Py_TAG_BITS +#include "internal/pycore_debug_offsets.h" // _Py_DebugOffsets +#include "internal/pycore_frame.h" // FRAME_SUSPENDED_YIELD_FROM +#include "internal/pycore_interpframe.h" // FRAME_OWNED_BY_INTERPRETER +#include "internal/pycore_llist.h" // struct llist_node +#include "internal/pycore_long.h" // _PyLong_GetZero +#include "internal/pycore_stackref.h" // Py_TAG_BITS #include "../../Python/remote_debug.h" #include <assert.h> @@ -40,10 +41,17 @@ extern "C" { # define HAVE_PROCESS_VM_READV 0 #endif -#if defined(__APPLE__) && TARGET_OS_OSX -#include <libproc.h> -#include <sys/types.h> -#define MAX_NATIVE_THREADS 4096 +#if defined(__APPLE__) +#include <TargetConditionals.h> +# if !defined(TARGET_OS_OSX) + /* Older macOS SDKs do not define TARGET_OS_OSX */ +# define TARGET_OS_OSX 1 +# endif +# if TARGET_OS_OSX +# include <libproc.h> +# include <sys/types.h> +# define MAX_NATIVE_THREADS 4096 +# endif #endif #ifdef MS_WINDOWS @@ -581,6 +589,16 @@ extern int process_thread_for_async_stack_trace( void *context ); +/* ============================================================================ + * SUBPROCESS ENUMERATION FUNCTION DECLARATIONS + * ============================================================================ */ + +/* Get all child PIDs of a process. + * Returns a new Python list of PIDs, or NULL on error with exception set. + * If recursive is true, includes all descendants (children, grandchildren, etc.) + */ +extern PyObject *enumerate_child_pids(pid_t target_pid, int recursive); + #ifdef __cplusplus } #endif |
