|
19 | 19 | #endif |
20 | 20 |
|
21 | 21 | #ifdef MS_WINDOWS |
22 | | -#define STATUS_INVALID_INFO_CLASS ((NTSTATUS)0xC0000003L) |
23 | | -#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) |
24 | | - |
25 | 22 | enum { |
26 | 23 | /* ThreadSystemThreadInformation is not named in the Windows SDK. */ |
27 | 24 | WIN32_THREAD_SYSTEM_INFORMATION = 40, |
@@ -170,7 +167,7 @@ find_running_frame( |
170 | 167 | * ============================================================================ */ |
171 | 168 |
|
172 | 169 | #ifdef MS_WINDOWS |
173 | | -SYSTEM_PROCESS_INFORMATION * |
| 170 | +static SYSTEM_PROCESS_INFORMATION * |
174 | 171 | win32_get_process_info(RemoteUnwinderObject *unwinder) |
175 | 172 | { |
176 | 173 | for (;;) { |
@@ -206,6 +203,9 @@ win32_get_process_info(RemoteUnwinderObject *unwinder) |
206 | 203 | static int |
207 | 204 | get_snapshot_thread_status(RemoteUnwinderObject *unwinder, unsigned long tid) |
208 | 205 | { |
| 206 | + if (unwinder->win_process_info == NULL) { |
| 207 | + unwinder->win_process_info = win32_get_process_info(unwinder); |
| 208 | + } |
209 | 209 | SYSTEM_PROCESS_INFORMATION *process = unwinder->win_process_info; |
210 | 210 | if (process != NULL) { |
211 | 211 | SYSTEM_THREAD_INFORMATION *threads = (SYSTEM_THREAD_INFORMATION *)(process + 1); |
@@ -287,7 +287,6 @@ get_thread_status(RemoteUnwinderObject *unwinder, unsigned long tid) { |
287 | 287 | if (result == STATUS_INVALID_INFO_CLASS) { |
288 | 288 | // WOW64 on Windows Server 2022 does not support this information class. |
289 | 289 | unwinder->win_use_process_snapshot = 1; |
290 | | - unwinder->win_process_info = win32_get_process_info(unwinder); |
291 | 290 | return get_snapshot_thread_status(unwinder, tid); |
292 | 291 | } |
293 | 292 | if (result != STATUS_SUCCESS || size != sizeof(info) || |
|
0 commit comments