mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
29a63e572a
`DebugActiveProcess()` can fail under certain circumstances, which results in us not seeing the crashing thread, hence you don't get a backtrace (in fact, the backtracer used to crash, since we never expected to be in that situation). Instead, use `NtQuerySystemInformation()` to get the thread list, then `OpenProcess()` and `OpenThread()` to get process/thread handles. This should be more robust. rdar://171438432
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
//===--- WinNTInternals.h - Windows specifics -------------------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2026 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Definitions of some NT internal functions that we make use of.
|
|
//
|
|
// This is technically naughty, but it is more robust than using the
|
|
// DebugActiveProcess() API, which sometimes appears to fail to work.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_BACKTRACING_WINNT_INTERNALS_H
|
|
#define SWIFT_BACKTRACING_WINNT_INTERNALS_H
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <windows.h>
|
|
#include <winternl.h>
|
|
|
|
#ifndef STATUS_INFO_LENGTH_MISMATCH
|
|
#define STATUS_INFO_LENGTH_MISMATCH ((DWORD)0xC0000004L)
|
|
#endif
|
|
|
|
typedef __kernel_entry NTSTATUS (NTAPI *PNT_QUERY_SYSTEM_INFORMATION)(
|
|
SYSTEM_INFORMATION_CLASS,
|
|
PVOID,
|
|
ULONG,
|
|
PULONG
|
|
);
|
|
|
|
typedef __kernel_entry NTSTATUS (NTAPI *PNT_SUSPEND_PROCESS)(
|
|
HANDLE
|
|
);
|
|
|
|
typedef __kernel_entry NTSTATUS (NTAPI *PNT_RESUME_PROCESS)(
|
|
HANDLE
|
|
);
|
|
|
|
#endif
|
|
|
|
#endif // SWIFT_BACKTRACING_WINNT_INTERNALS_H
|