Skip to content

make backtrace = false compile for windows targets. #44979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/libstd/sys/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,13 @@ pub const WAIT_TIMEOUT: DWORD = 258;
pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;

#[cfg(target_env = "msvc")]
#[cfg(feature = "backtrace")]
pub const MAX_SYM_NAME: usize = 2000;
#[cfg(target_arch = "x86")]
#[cfg(feature = "backtrace")]
pub const IMAGE_FILE_MACHINE_I386: DWORD = 0x014c;
#[cfg(target_arch = "x86_64")]
#[cfg(feature = "backtrace")]
pub const IMAGE_FILE_MACHINE_AMD64: DWORD = 0x8664;

pub const PROV_RSA_FULL: DWORD = 1;
Expand Down Expand Up @@ -575,6 +578,7 @@ pub struct OVERLAPPED {

#[repr(C)]
#[cfg(target_env = "msvc")]
#[cfg(feature = "backtrace")]
pub struct SYMBOL_INFO {
pub SizeOfStruct: c_ulong,
pub TypeIndex: c_ulong,
Expand All @@ -598,6 +602,7 @@ pub struct SYMBOL_INFO {

#[repr(C)]
#[cfg(target_env = "msvc")]
#[cfg(feature = "backtrace")]
pub struct IMAGEHLP_LINE64 {
pub SizeOfStruct: u32,
pub Key: *const c_void,
Expand All @@ -616,13 +621,15 @@ pub enum ADDRESS_MODE {
}

#[repr(C)]
#[cfg(feature = "backtrace")]
pub struct ADDRESS64 {
pub Offset: u64,
pub Segment: u16,
pub Mode: ADDRESS_MODE,
}

#[repr(C)]
#[cfg(feature = "backtrace")]
pub struct STACKFRAME64 {
pub AddrPC: ADDRESS64,
pub AddrReturn: ADDRESS64,
Expand All @@ -638,6 +645,7 @@ pub struct STACKFRAME64 {
}

#[repr(C)]
#[cfg(feature = "backtrace")]
pub struct KDHELP64 {
pub Thread: u64,
pub ThCallbackStack: DWORD,
Expand Down Expand Up @@ -1089,6 +1097,7 @@ extern "system" {
pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
-> BOOL;
pub fn FindClose(findFile: HANDLE) -> BOOL;
#[cfg(feature = "backtrace")]
pub fn RtlCaptureContext(ctx: *mut CONTEXT);
pub fn getsockopt(s: SOCKET,
level: c_int,
Expand Down Expand Up @@ -1120,7 +1129,9 @@ extern "system" {
res: *mut *mut ADDRINFOA) -> c_int;
pub fn freeaddrinfo(res: *mut ADDRINFOA);

#[cfg(feature = "backtrace")]
pub fn LoadLibraryW(name: LPCWSTR) -> HMODULE;
#[cfg(feature = "backtrace")]
pub fn FreeLibrary(handle: HMODULE) -> BOOL;
pub fn GetProcAddress(handle: HMODULE,
name: LPCSTR) -> *mut c_void;
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/sys/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ use time::Duration;
#[macro_use] pub mod compat;

pub mod args;
#[cfg(feature = "backtrace")]
pub mod backtrace;
pub mod c;
pub mod condvar;
#[cfg(feature = "backtrace")]
pub mod dynamic_lib;
pub mod env;
pub mod ext;
Expand Down