Skip to content

Commit 5c978cc

Browse files
committed
up
1 parent 53046a5 commit 5c978cc

3 files changed

Lines changed: 7 additions & 13 deletions

File tree

‎Modules/_remote_debugging/_remote_debugging.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ typedef struct {
103103

104104
#ifdef MS_WINDOWS
105105
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
106+
#define STATUS_INVALID_INFO_CLASS ((NTSTATUS)0xC0000003L)
107+
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
106108
#define STATUS_NO_MORE_ENTRIES ((NTSTATUS)0x8000001AL)
107109
#endif
108110

@@ -664,10 +666,6 @@ extern int find_running_frame(
664666
uintptr_t *frame
665667
);
666668

667-
#ifdef MS_WINDOWS
668-
extern SYSTEM_PROCESS_INFORMATION *win32_get_process_info(RemoteUnwinderObject *unwinder);
669-
#endif
670-
671669
extern PyObject* unwind_stack_for_thread(
672670
RemoteUnwinderObject *unwinder,
673671
uintptr_t *current_tstate,

‎Modules/_remote_debugging/module.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,7 @@ _remote_debugging_RemoteUnwinder_get_stack_trace_impl(RemoteUnwinderObject *self
689689
}
690690

691691
#ifdef MS_WINDOWS
692-
if (self->win_use_process_snapshot &&
693-
(self->mode == PROFILING_MODE_CPU || self->mode == PROFILING_MODE_ALL)) {
694-
self->win_process_info = win32_get_process_info(self);
695-
}
692+
self->win_process_info = NULL;
696693
#endif
697694

698695
// Iterate over all interpreters

‎Modules/_remote_debugging/threads.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
#endif
2020

2121
#ifdef MS_WINDOWS
22-
#define STATUS_INVALID_INFO_CLASS ((NTSTATUS)0xC0000003L)
23-
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
24-
2522
enum {
2623
/* ThreadSystemThreadInformation is not named in the Windows SDK. */
2724
WIN32_THREAD_SYSTEM_INFORMATION = 40,
@@ -170,7 +167,7 @@ find_running_frame(
170167
* ============================================================================ */
171168

172169
#ifdef MS_WINDOWS
173-
SYSTEM_PROCESS_INFORMATION *
170+
static SYSTEM_PROCESS_INFORMATION *
174171
win32_get_process_info(RemoteUnwinderObject *unwinder)
175172
{
176173
for (;;) {
@@ -206,6 +203,9 @@ win32_get_process_info(RemoteUnwinderObject *unwinder)
206203
static int
207204
get_snapshot_thread_status(RemoteUnwinderObject *unwinder, unsigned long tid)
208205
{
206+
if (unwinder->win_process_info == NULL) {
207+
unwinder->win_process_info = win32_get_process_info(unwinder);
208+
}
209209
SYSTEM_PROCESS_INFORMATION *process = unwinder->win_process_info;
210210
if (process != NULL) {
211211
SYSTEM_THREAD_INFORMATION *threads = (SYSTEM_THREAD_INFORMATION *)(process + 1);
@@ -287,7 +287,6 @@ get_thread_status(RemoteUnwinderObject *unwinder, unsigned long tid) {
287287
if (result == STATUS_INVALID_INFO_CLASS) {
288288
// WOW64 on Windows Server 2022 does not support this information class.
289289
unwinder->win_use_process_snapshot = 1;
290-
unwinder->win_process_info = win32_get_process_info(unwinder);
291290
return get_snapshot_thread_status(unwinder, tid);
292291
}
293292
if (result != STATUS_SUCCESS || size != sizeof(info) ||

0 commit comments

Comments
 (0)