Skip to content

Commit f01d8d3

Browse files
committed
Small fixes
1 parent 80856d3 commit f01d8d3

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

Lib/test/test_capi/test_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def test_config_get(self):
7373
("program_name", str, None),
7474
("pycache_prefix", str | None, "pycache_prefix"),
7575
("quiet", bool, None),
76+
("remote_debug", int, None),
7677
("run_command", str | None, None),
7778
("run_filename", str | None, None),
7879
("run_module", str | None, None),

Lib/test/test_embed.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
626626
'write_bytecode': True,
627627
'verbose': 0,
628628
'quiet': False,
629+
'remote_debug': True,
629630
'user_site_directory': True,
630631
'configure_c_stdio': False,
631632
'buffered_stdio': True,
@@ -975,7 +976,7 @@ def test_init_global_config(self):
975976
'verbose': True,
976977
'quiet': True,
977978
'buffered_stdio': False,
978-
979+
'remote_debug': True,
979980
'user_site_directory': False,
980981
'pathconfig_warnings': False,
981982
}
@@ -1031,6 +1032,7 @@ def test_init_from_config(self):
10311032
'write_bytecode': False,
10321033
'verbose': 1,
10331034
'quiet': True,
1035+
'remote_debug': True,
10341036
'configure_c_stdio': True,
10351037
'buffered_stdio': False,
10361038
'user_site_directory': False,

Python/remote_debugging.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
# define HAVE_PROCESS_VM_READV 0
6969
#endif
7070

71+
#if (defined(__APPLE__) || defined(MS_WINDOWS) || (defined(__linux__) && HAVE_PROCESS_VM_READV))
72+
# define Py_SUPPORTS_REMOTE_DEBUG 1
73+
#endif
74+
75+
7176
// Define a platform-independent process handle structure
7277
typedef struct {
7378
pid_t pid;
@@ -104,10 +109,7 @@ cleanup_proc_handle(proc_handle_t *handle) {
104109
handle->pid = 0;
105110
}
106111

107-
/*[clinic input]
108-
module _pdb
109-
[clinic start generated code]*/
110-
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=7fb1cf2618bcf972]*/
112+
#ifdef Py_SUPPORTS_REMOTE_DEBUG
111113

112114
#if defined(__APPLE__) && TARGET_OS_OSX
113115
static uintptr_t
@@ -298,7 +300,7 @@ search_map_for_section(proc_handle_t *handle, const char* secname, const char* s
298300

299301
#endif // (__APPLE__ && TARGET_OS_OSX)
300302

301-
#ifdef __linux__
303+
#if defined(__linux__) && HAVE_PROCESS_VM_READV
302304
static uintptr_t
303305
find_map_start_address(proc_handle_t *handle, char* result_filename, const char* map)
304306
{
@@ -921,6 +923,8 @@ send_exec_to_proc_handle(proc_handle_t *handle, int tid, const char *debugger_sc
921923
return 0;
922924
}
923925

926+
#endif // defined(Py_SUPPORTS_REMOTE_DEBUG)
927+
924928
int
925929
_PySysRemoteDebug_SendExec(int pid, int tid, const char *debugger_script_path)
926930
{

0 commit comments

Comments
 (0)