1 //===-- sanitizer_win.cc --------------------------------------------------===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is shared between AddressSanitizer and ThreadSanitizer
9 // run-time libraries and implements windows-specific functions from
11 //===----------------------------------------------------------------------===//
13 #include "sanitizer_platform.h"
16 #define WIN32_LEAN_AND_MEAN
24 #include "sanitizer_common.h"
25 #include "sanitizer_libc.h"
26 #include "sanitizer_mutex.h"
27 #include "sanitizer_placement_new.h"
28 #include "sanitizer_stacktrace.h"
30 namespace __sanitizer
{
32 #include "sanitizer_syscall_generic.inc"
34 // --------------------- sanitizer_common.h
36 // FIXME: there is an API for getting the system page size (GetSystemInfo or
37 // GetNativeSystemInfo), but if we use it here we get test failures elsewhere.
41 uptr
GetMmapGranularity() {
42 return 1U << 16; // FIXME: is this configurable?
45 uptr
GetMaxVirtualAddress() {
48 return (uptr
)si
.lpMaximumApplicationAddress
;
51 bool FileExists(const char *filename
) {
52 return ::GetFileAttributesA(filename
) != INVALID_FILE_ATTRIBUTES
;
55 uptr
internal_getpid() {
56 return GetProcessId(GetCurrentProcess());
59 // In contrast to POSIX, on Windows GetCurrentThreadId()
60 // returns a system-unique identifier.
62 return GetCurrentThreadId();
65 uptr
GetThreadSelf() {
70 void GetThreadStackTopAndBottom(bool at_initialization
, uptr
*stack_top
,
74 MEMORY_BASIC_INFORMATION mbi
;
75 CHECK_NE(VirtualQuery(&mbi
/* on stack */, &mbi
, sizeof(mbi
)), 0);
76 // FIXME: is it possible for the stack to not be a single allocation?
77 // Are these values what ASan expects to get (reserved, not committed;
78 // including stack guard page) ?
79 *stack_top
= (uptr
)mbi
.BaseAddress
+ mbi
.RegionSize
;
80 *stack_bottom
= (uptr
)mbi
.AllocationBase
;
82 #endif // #if !SANITIZER_GO
84 void *MmapOrDie(uptr size
, const char *mem_type
) {
85 void *rv
= VirtualAlloc(0, size
, MEM_RESERVE
| MEM_COMMIT
, PAGE_READWRITE
);
87 ReportMmapFailureAndDie(size
, mem_type
, "allocate", GetLastError());
91 void UnmapOrDie(void *addr
, uptr size
) {
95 if (VirtualFree(addr
, size
, MEM_DECOMMIT
) == 0) {
96 Report("ERROR: %s failed to "
97 "deallocate 0x%zx (%zd) bytes at address %p (error code: %d)\n",
98 SanitizerToolName
, size
, size
, addr
, GetLastError());
99 CHECK("unable to unmap" && 0);
103 void *MmapFixedNoReserve(uptr fixed_addr
, uptr size
, const char *name
) {
104 // FIXME: is this really "NoReserve"? On Win32 this does not matter much,
105 // but on Win64 it does.
106 (void)name
; // unsupported
107 void *p
= VirtualAlloc((LPVOID
)fixed_addr
, size
,
108 MEM_RESERVE
| MEM_COMMIT
, PAGE_READWRITE
);
110 Report("ERROR: %s failed to "
111 "allocate %p (%zd) bytes at %p (error code: %d)\n",
112 SanitizerToolName
, size
, size
, fixed_addr
, GetLastError());
116 void *MmapFixedOrDie(uptr fixed_addr
, uptr size
) {
117 return MmapFixedNoReserve(fixed_addr
, size
);
120 void *MmapNoReserveOrDie(uptr size
, const char *mem_type
) {
121 // FIXME: make this really NoReserve?
122 return MmapOrDie(size
, mem_type
);
125 void *MmapNoAccess(uptr fixed_addr
, uptr size
, const char *name
) {
126 (void)name
; // unsupported
127 void *res
= VirtualAlloc((LPVOID
)fixed_addr
, size
,
128 MEM_RESERVE
| MEM_COMMIT
, PAGE_NOACCESS
);
130 Report("WARNING: %s failed to "
131 "mprotect %p (%zd) bytes at %p (error code: %d)\n",
132 SanitizerToolName
, size
, size
, fixed_addr
, GetLastError());
136 bool MprotectNoAccess(uptr addr
, uptr size
) {
137 DWORD old_protection
;
138 return VirtualProtect((LPVOID
)addr
, size
, PAGE_NOACCESS
, &old_protection
);
142 void FlushUnneededShadowMemory(uptr addr
, uptr size
) {
143 // This is almost useless on 32-bits.
144 // FIXME: add madvise-analog when we move to 64-bits.
147 void NoHugePagesInRegion(uptr addr
, uptr size
) {
148 // FIXME: probably similar to FlushUnneededShadowMemory.
151 void DontDumpShadowMemory(uptr addr
, uptr length
) {
152 // This is almost useless on 32-bits.
153 // FIXME: add madvise-analog when we move to 64-bits.
156 bool MemoryRangeIsAvailable(uptr range_start
, uptr range_end
) {
157 MEMORY_BASIC_INFORMATION mbi
;
158 CHECK(VirtualQuery((void *)range_start
, &mbi
, sizeof(mbi
)));
159 return mbi
.Protect
== PAGE_NOACCESS
&&
160 (uptr
)mbi
.BaseAddress
+ mbi
.RegionSize
>= range_end
;
163 void *MapFileToMemory(const char *file_name
, uptr
*buff_size
) {
167 void *MapWritableFileToMemory(void *addr
, uptr size
, fd_t fd
, OFF_T offset
) {
171 static const int kMaxEnvNameLength
= 128;
172 static const DWORD kMaxEnvValueLength
= 32767;
177 char name
[kMaxEnvNameLength
];
178 char value
[kMaxEnvValueLength
];
183 static const int kEnvVariables
= 5;
184 static EnvVariable env_vars
[kEnvVariables
];
185 static int num_env_vars
;
187 const char *GetEnv(const char *name
) {
188 // Note: this implementation caches the values of the environment variables
189 // and limits their quantity.
190 for (int i
= 0; i
< num_env_vars
; i
++) {
191 if (0 == internal_strcmp(name
, env_vars
[i
].name
))
192 return env_vars
[i
].value
;
194 CHECK_LT(num_env_vars
, kEnvVariables
);
195 DWORD rv
= GetEnvironmentVariableA(name
, env_vars
[num_env_vars
].value
,
197 if (rv
> 0 && rv
< kMaxEnvValueLength
) {
198 CHECK_LT(internal_strlen(name
), kMaxEnvNameLength
);
199 internal_strncpy(env_vars
[num_env_vars
].name
, name
, kMaxEnvNameLength
);
201 return env_vars
[num_env_vars
- 1].value
;
206 const char *GetPwd() {
216 const char *filepath
;
222 int CompareModulesBase(const void *pl
, const void *pr
) {
223 const ModuleInfo
*l
= (ModuleInfo
*)pl
, *r
= (ModuleInfo
*)pr
;
224 if (l
->base_address
< r
->base_address
)
226 return l
->base_address
> r
->base_address
;
232 void DumpProcessMap() {
233 Report("Dumping process modules:\n");
234 InternalScopedBuffer
<LoadedModule
> modules(kMaxNumberOfModules
);
236 GetListOfModules(modules
.data(), kMaxNumberOfModules
, nullptr);
238 InternalScopedBuffer
<ModuleInfo
> module_infos(num_modules
);
239 for (size_t i
= 0; i
< num_modules
; ++i
) {
240 module_infos
[i
].filepath
= modules
[i
].full_name();
241 module_infos
[i
].base_address
= modules
[i
].base_address();
242 module_infos
[i
].end_address
= modules
[i
].ranges().next()->end
;
244 qsort(module_infos
.data(), num_modules
, sizeof(ModuleInfo
),
247 for (size_t i
= 0; i
< num_modules
; ++i
) {
248 const ModuleInfo
&mi
= module_infos
[i
];
249 if (mi
.end_address
!= 0) {
250 Printf("\t%p-%p %s\n", mi
.base_address
, mi
.end_address
,
251 mi
.filepath
[0] ? mi
.filepath
: "[no name]");
252 } else if (mi
.filepath
[0]) {
253 Printf("\t??\?-??? %s\n", mi
.filepath
);
261 void DisableCoreDumperIfNecessary() {
269 void PrepareForSandboxing(__sanitizer_sandbox_arguments
*args
) {
271 CovPrepareForSandboxing(args
);
275 bool StackSizeIsUnlimited() {
279 void SetStackSizeLimitInBytes(uptr limit
) {
283 bool AddressSpaceIsUnlimited() {
287 void SetAddressSpaceUnlimited() {
291 bool IsPathSeparator(const char c
) {
292 return c
== '\\' || c
== '/';
295 bool IsAbsolutePath(const char *path
) {
299 void SleepForSeconds(int seconds
) {
300 Sleep(seconds
* 1000);
303 void SleepForMillis(int millis
) {
312 if (::IsDebuggerPresent())
317 // Read the file to extract the ImageBase field from the PE header. If ASLR is
318 // disabled and this virtual address is available, the loader will typically
319 // load the image at this address. Therefore, we call it the preferred base. Any
320 // addresses in the DWARF typically assume that the object has been loaded at
322 static uptr
GetPreferredBase(const char *modname
) {
323 fd_t fd
= OpenFile(modname
, RdOnly
, nullptr);
324 if (fd
== kInvalidFd
)
326 FileCloser
closer(fd
);
328 // Read just the DOS header.
329 IMAGE_DOS_HEADER dos_header
;
331 if (!ReadFromFile(fd
, &dos_header
, sizeof(dos_header
), &bytes_read
) ||
332 bytes_read
!= sizeof(dos_header
))
335 // The file should start with the right signature.
336 if (dos_header
.e_magic
!= IMAGE_DOS_SIGNATURE
)
339 // The layout at e_lfanew is:
342 // IMAGE_OPTIONAL_HEADER
343 // Seek to e_lfanew and read all that data.
344 char buf
[4 + sizeof(IMAGE_FILE_HEADER
) + sizeof(IMAGE_OPTIONAL_HEADER
)];
345 if (::SetFilePointer(fd
, dos_header
.e_lfanew
, nullptr, FILE_BEGIN
) ==
346 INVALID_SET_FILE_POINTER
)
348 if (!ReadFromFile(fd
, &buf
[0], sizeof(buf
), &bytes_read
) ||
349 bytes_read
!= sizeof(buf
))
352 // Check for "PE\0\0" before the PE header.
353 char *pe_sig
= &buf
[0];
354 if (internal_memcmp(pe_sig
, "PE\0\0", 4) != 0)
357 // Skip over IMAGE_FILE_HEADER. We could do more validation here if we wanted.
358 IMAGE_OPTIONAL_HEADER
*pe_header
=
359 (IMAGE_OPTIONAL_HEADER
*)(pe_sig
+ 4 + sizeof(IMAGE_FILE_HEADER
));
361 // Check for more magic in the PE header.
362 if (pe_header
->Magic
!= IMAGE_NT_OPTIONAL_HDR_MAGIC
)
365 // Finally, return the ImageBase.
366 return (uptr
)pe_header
->ImageBase
;
370 uptr
GetListOfModules(LoadedModule
*modules
, uptr max_modules
,
371 string_predicate_t filter
) {
372 HANDLE cur_process
= GetCurrentProcess();
374 // Query the list of modules. Start by assuming there are no more than 256
375 // modules and retry if that's not sufficient.
376 HMODULE
*hmodules
= 0;
377 uptr modules_buffer_size
= sizeof(HMODULE
) * 256;
378 DWORD bytes_required
;
380 hmodules
= (HMODULE
*)MmapOrDie(modules_buffer_size
, __FUNCTION__
);
381 CHECK(EnumProcessModules(cur_process
, hmodules
, modules_buffer_size
,
383 if (bytes_required
> modules_buffer_size
) {
384 // Either there turned out to be more than 256 hmodules, or new hmodules
385 // could have loaded since the last try. Retry.
386 UnmapOrDie(hmodules
, modules_buffer_size
);
388 modules_buffer_size
= bytes_required
;
392 // |num_modules| is the number of modules actually present,
393 // |count| is the number of modules we return.
394 size_t nun_modules
= bytes_required
/ sizeof(HMODULE
),
396 for (size_t i
= 0; i
< nun_modules
&& count
< max_modules
; ++i
) {
397 HMODULE handle
= hmodules
[i
];
399 if (!GetModuleInformation(cur_process
, handle
, &mi
, sizeof(mi
)))
402 // Get the UTF-16 path and convert to UTF-8.
403 wchar_t modname_utf16
[kMaxPathLength
];
404 int modname_utf16_len
=
405 GetModuleFileNameW(handle
, modname_utf16
, kMaxPathLength
);
406 if (modname_utf16_len
== 0)
407 modname_utf16
[0] = '\0';
408 char module_name
[kMaxPathLength
];
409 int module_name_len
=
410 ::WideCharToMultiByte(CP_UTF8
, 0, modname_utf16
, modname_utf16_len
+ 1,
411 &module_name
[0], kMaxPathLength
, NULL
, NULL
);
412 module_name
[module_name_len
] = '\0';
414 if (filter
&& !filter(module_name
))
417 uptr base_address
= (uptr
)mi
.lpBaseOfDll
;
418 uptr end_address
= (uptr
)mi
.lpBaseOfDll
+ mi
.SizeOfImage
;
420 // Adjust the base address of the module so that we get a VA instead of an
421 // RVA when computing the module offset. This helps llvm-symbolizer find the
422 // right DWARF CU. In the common case that the image is loaded at it's
423 // preferred address, we will now print normal virtual addresses.
424 uptr preferred_base
= GetPreferredBase(&module_name
[0]);
425 uptr adjusted_base
= base_address
- preferred_base
;
427 LoadedModule
*cur_module
= &modules
[count
];
428 cur_module
->set(module_name
, adjusted_base
);
429 // We add the whole module as one single address range.
430 cur_module
->addAddressRange(base_address
, end_address
, /*executable*/ true);
433 UnmapOrDie(hmodules
, modules_buffer_size
);
438 // We can't use atexit() directly at __asan_init time as the CRT is not fully
439 // initialized at this point. Place the functions into a vector and use
440 // atexit() as soon as it is ready for use (i.e. after .CRT$XIC initializers).
441 InternalMmapVectorNoCtor
<void (*)(void)> atexit_functions
;
443 int Atexit(void (*function
)(void)) {
444 atexit_functions
.push_back(function
);
448 static int RunAtexit() {
450 for (uptr i
= 0; i
< atexit_functions
.size(); ++i
) {
451 ret
|= atexit(atexit_functions
[i
]);
456 #pragma section(".CRT$XID", long, read) // NOLINT
457 __declspec(allocate(".CRT$XID")) int (*__run_atexit
)() = RunAtexit
;
460 // ------------------ sanitizer_libc.h
461 fd_t
OpenFile(const char *filename
, FileAccessMode mode
, error_t
*last_error
) {
463 if (mode
== RdOnly
) {
464 res
= CreateFile(filename
, GENERIC_READ
,
465 FILE_SHARE_READ
| FILE_SHARE_WRITE
| FILE_SHARE_DELETE
,
466 nullptr, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, nullptr);
467 } else if (mode
== WrOnly
) {
468 res
= CreateFile(filename
, GENERIC_WRITE
, 0, nullptr, CREATE_ALWAYS
,
469 FILE_ATTRIBUTE_NORMAL
, nullptr);
473 CHECK(res
!= kStdoutFd
|| kStdoutFd
== kInvalidFd
);
474 CHECK(res
!= kStderrFd
|| kStderrFd
== kInvalidFd
);
475 if (res
== kInvalidFd
&& last_error
)
476 *last_error
= GetLastError();
480 void CloseFile(fd_t fd
) {
484 bool ReadFromFile(fd_t fd
, void *buff
, uptr buff_size
, uptr
*bytes_read
,
486 CHECK(fd
!= kInvalidFd
);
488 // bytes_read can't be passed directly to ReadFile:
489 // uptr is unsigned long long on 64-bit Windows.
490 unsigned long num_read_long
;
492 bool success
= ::ReadFile(fd
, buff
, buff_size
, &num_read_long
, nullptr);
493 if (!success
&& error_p
)
494 *error_p
= GetLastError();
496 *bytes_read
= num_read_long
;
500 bool SupportsColoredOutput(fd_t fd
) {
501 // FIXME: support colored output.
505 bool WriteToFile(fd_t fd
, const void *buff
, uptr buff_size
, uptr
*bytes_written
,
507 CHECK(fd
!= kInvalidFd
);
509 // Handle null optional parameters.
511 error_p
= error_p
? error_p
: &dummy_error
;
512 uptr dummy_bytes_written
;
513 bytes_written
= bytes_written
? bytes_written
: &dummy_bytes_written
;
515 // Initialize output parameters in case we fail.
519 // Map the conventional Unix fds 1 and 2 to Windows handles. They might be
520 // closed, in which case this will fail.
521 if (fd
== kStdoutFd
|| fd
== kStderrFd
) {
522 fd
= GetStdHandle(fd
== kStdoutFd
? STD_OUTPUT_HANDLE
: STD_ERROR_HANDLE
);
524 *error_p
= ERROR_INVALID_HANDLE
;
529 DWORD bytes_written_32
;
530 if (!WriteFile(fd
, buff
, buff_size
, &bytes_written_32
, 0)) {
531 *error_p
= GetLastError();
534 *bytes_written
= bytes_written_32
;
539 bool RenameFile(const char *oldpath
, const char *newpath
, error_t
*error_p
) {
543 uptr
internal_sched_yield() {
548 void internal__exit(int exitcode
) {
549 ExitProcess(exitcode
);
552 uptr
internal_ftruncate(fd_t fd
, uptr size
) {
560 void *internal_start_thread(void (*func
)(void *arg
), void *arg
) { return 0; }
561 void internal_join_thread(void *th
) { }
563 // ---------------------- BlockingMutex ---------------- {{{1
564 const uptr LOCK_UNINITIALIZED
= 0;
565 const uptr LOCK_READY
= (uptr
)-1;
567 BlockingMutex::BlockingMutex(LinkerInitialized li
) {
568 // FIXME: see comments in BlockingMutex::Lock() for the details.
569 CHECK(li
== LINKER_INITIALIZED
|| owner_
== LOCK_UNINITIALIZED
);
571 CHECK(sizeof(CRITICAL_SECTION
) <= sizeof(opaque_storage_
));
572 InitializeCriticalSection((LPCRITICAL_SECTION
)opaque_storage_
);
576 BlockingMutex::BlockingMutex() {
577 CHECK(sizeof(CRITICAL_SECTION
) <= sizeof(opaque_storage_
));
578 InitializeCriticalSection((LPCRITICAL_SECTION
)opaque_storage_
);
582 void BlockingMutex::Lock() {
583 if (owner_
== LOCK_UNINITIALIZED
) {
584 // FIXME: hm, global BlockingMutex objects are not initialized?!?
585 // This might be a side effect of the clang+cl+link Frankenbuild...
586 new(this) BlockingMutex((LinkerInitialized
)(LINKER_INITIALIZED
+ 1));
588 // FIXME: If it turns out the linker doesn't invoke our
589 // constructors, we should probably manually Lock/Unlock all the global
590 // locks while we're starting in one thread to avoid double-init races.
592 EnterCriticalSection((LPCRITICAL_SECTION
)opaque_storage_
);
593 CHECK_EQ(owner_
, LOCK_READY
);
594 owner_
= GetThreadSelf();
597 void BlockingMutex::Unlock() {
598 CHECK_EQ(owner_
, GetThreadSelf());
600 LeaveCriticalSection((LPCRITICAL_SECTION
)opaque_storage_
);
603 void BlockingMutex::CheckLocked() {
604 CHECK_EQ(owner_
, GetThreadSelf());
614 void GetThreadStackAndTls(bool main
, uptr
*stk_addr
, uptr
*stk_size
,
615 uptr
*tls_addr
, uptr
*tls_size
) {
622 uptr stack_top
, stack_bottom
;
623 GetThreadStackTopAndBottom(main
, &stack_top
, &stack_bottom
);
624 *stk_addr
= stack_bottom
;
625 *stk_size
= stack_top
- stack_bottom
;
632 void BufferedStackTrace::SlowUnwindStack(uptr pc
, u32 max_depth
) {
633 CHECK_GE(max_depth
, 2);
634 // FIXME: CaptureStackBackTrace might be too slow for us.
635 // FIXME: Compare with StackWalk64.
636 // FIXME: Look at LLVMUnhandledExceptionFilter in Signals.inc
637 size
= CaptureStackBackTrace(2, Min(max_depth
, kStackTraceMax
),
642 // Skip the RTL frames by searching for the PC in the stacktrace.
643 uptr pc_location
= LocatePcInTrace(pc
);
644 PopStackFrames(pc_location
);
647 void BufferedStackTrace::SlowUnwindStackWithContext(uptr pc
, void *context
,
649 CONTEXT ctx
= *(CONTEXT
*)context
;
650 STACKFRAME64 stack_frame
;
651 memset(&stack_frame
, 0, sizeof(stack_frame
));
654 int machine_type
= IMAGE_FILE_MACHINE_AMD64
;
655 stack_frame
.AddrPC
.Offset
= ctx
.Rip
;
656 stack_frame
.AddrFrame
.Offset
= ctx
.Rbp
;
657 stack_frame
.AddrStack
.Offset
= ctx
.Rsp
;
659 int machine_type
= IMAGE_FILE_MACHINE_I386
;
660 stack_frame
.AddrPC
.Offset
= ctx
.Eip
;
661 stack_frame
.AddrFrame
.Offset
= ctx
.Ebp
;
662 stack_frame
.AddrStack
.Offset
= ctx
.Esp
;
664 stack_frame
.AddrPC
.Mode
= AddrModeFlat
;
665 stack_frame
.AddrFrame
.Mode
= AddrModeFlat
;
666 stack_frame
.AddrStack
.Mode
= AddrModeFlat
;
667 while (StackWalk64(machine_type
, GetCurrentProcess(), GetCurrentThread(),
668 &stack_frame
, &ctx
, NULL
, &SymFunctionTableAccess64
,
669 &SymGetModuleBase64
, NULL
) &&
670 size
< Min(max_depth
, kStackTraceMax
)) {
671 trace_buffer
[size
++] = (uptr
)stack_frame
.AddrPC
.Offset
;
674 #endif // #if !SANITIZER_GO
676 void ReportFile::Write(const char *buffer
, uptr length
) {
679 if (!WriteToFile(fd
, buffer
, length
)) {
680 // stderr may be closed, but we may be able to print to the debugger
681 // instead. This is the case when launching a program from Visual Studio,
682 // and the following routine should write to its console.
683 OutputDebugStringA(buffer
);
687 void SetAlternateSignalStack() {
688 // FIXME: Decide what to do on Windows.
691 void UnsetAlternateSignalStack() {
692 // FIXME: Decide what to do on Windows.
695 void InstallDeadlySignalHandlers(SignalHandlerType handler
) {
697 // FIXME: Decide what to do on Windows.
700 bool IsDeadlySignal(int signum
) {
701 // FIXME: Decide what to do on Windows.
705 bool IsAccessibleMemoryRange(uptr beg
, uptr size
) {
707 GetNativeSystemInfo(&si
);
708 uptr page_size
= si
.dwPageSize
;
709 uptr page_mask
= ~(page_size
- 1);
711 for (uptr page
= beg
& page_mask
, end
= (beg
+ size
- 1) & page_mask
;
713 MEMORY_BASIC_INFORMATION info
;
714 if (VirtualQuery((LPCVOID
)page
, &info
, sizeof(info
)) != sizeof(info
))
717 if (info
.Protect
== 0 || info
.Protect
== PAGE_NOACCESS
||
718 info
.Protect
== PAGE_EXECUTE
)
721 if (info
.RegionSize
== 0)
724 page
+= info
.RegionSize
;
730 SignalContext
SignalContext::Create(void *siginfo
, void *context
) {
731 EXCEPTION_RECORD
*exception_record
= (EXCEPTION_RECORD
*)siginfo
;
732 CONTEXT
*context_record
= (CONTEXT
*)context
;
734 uptr pc
= (uptr
)exception_record
->ExceptionAddress
;
736 uptr bp
= (uptr
)context_record
->Rbp
;
737 uptr sp
= (uptr
)context_record
->Rsp
;
739 uptr bp
= (uptr
)context_record
->Ebp
;
740 uptr sp
= (uptr
)context_record
->Esp
;
742 uptr access_addr
= exception_record
->ExceptionInformation
[1];
744 return SignalContext(context
, access_addr
, pc
, sp
, bp
);
747 uptr
ReadBinaryName(/*out*/char *buf
, uptr buf_len
) {
748 // FIXME: Actually implement this function.
749 CHECK_GT(buf_len
, 0);
754 uptr
ReadLongProcessName(/*out*/char *buf
, uptr buf_len
) {
755 return ReadBinaryName(buf
, buf_len
);
758 void CheckVMASize() {
762 } // namespace __sanitizer