Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(941)

Side by Side Diff: lib/asan/asan_internal.h

Issue 5647052: [ASan] The first version of the RTL for Windows (Closed)
Patch Set: Added a couple of FIXMEs Created 13 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===-- asan_internal.h -----------------------------------------*- C++ -*-===// 1 //===-- asan_internal.h -----------------------------------------*- C++ -*-===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file is a part of AddressSanitizer, an address sanity checker. 10 // This file is a part of AddressSanitizer, an address sanity checker.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 #define UNIMPLEMENTED() CHECK("unimplemented" && 0) 208 #define UNIMPLEMENTED() CHECK("unimplemented" && 0)
209 209
210 #define ASAN_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) 210 #define ASAN_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
211 211
212 const size_t kWordSize = __WORDSIZE / 8; 212 const size_t kWordSize = __WORDSIZE / 8;
213 const size_t kWordSizeInBits = 8 * kWordSize; 213 const size_t kWordSizeInBits = 8 * kWordSize;
214 const size_t kPageSizeBits = 12; 214 const size_t kPageSizeBits = 12;
215 const size_t kPageSize = 1UL << kPageSizeBits; 215 const size_t kPageSize = 1UL << kPageSizeBits;
216 216
217 #ifndef _WIN32 217 #ifndef _WIN32
218 const size_t kMmapGranularity = kPageSize;
218 # define GET_CALLER_PC() (uintptr_t)__builtin_return_address(0) 219 # define GET_CALLER_PC() (uintptr_t)__builtin_return_address(0)
219 # define GET_CURRENT_FRAME() (uintptr_t)__builtin_frame_address(0) 220 # define GET_CURRENT_FRAME() (uintptr_t)__builtin_frame_address(0)
220 #else 221 #else
222 const size_t kMmapGranularity = 1UL << 16;
221 # define GET_CALLER_PC() (uintptr_t)_ReturnAddress() 223 # define GET_CALLER_PC() (uintptr_t)_ReturnAddress()
222 // CaptureStackBackTrace doesn't need to know BP on Windows. 224 // CaptureStackBackTrace doesn't need to know BP on Windows.
223 // FIXME: This macro is still used when printing error reports though it's not 225 // FIXME: This macro is still used when printing error reports though it's not
224 // clear if the BP value is needed in the ASan reports on Windows. 226 // clear if the BP value is needed in the ASan reports on Windows.
225 # define GET_CURRENT_FRAME() (uintptr_t)0xDEADBEEF 227 # define GET_CURRENT_FRAME() (uintptr_t)0xDEADBEEF
228
229 # ifndef ASAN_USE_EXTERNAL_SYMBOLIZER
230 # define ASAN_USE_EXTERNAL_SYMBOLIZER __asan::WinSymbolize
timurrrr_at_google_com 2012/02/08 14:49:13 Alternative suggestions are welcome if you believe
glider 2012/02/08 15:30:09 LG
231 bool WinSymbolize(const void *addr, char *out_buffer, int buffer_size);
232 # endif
226 #endif 233 #endif
227 234
228 #define GET_BP_PC_SP \ 235 #define GET_BP_PC_SP \
229 uintptr_t bp = GET_CURRENT_FRAME(); \ 236 uintptr_t bp = GET_CURRENT_FRAME(); \
230 uintptr_t pc = GET_CALLER_PC(); \ 237 uintptr_t pc = GET_CALLER_PC(); \
231 uintptr_t local_stack; \ 238 uintptr_t local_stack; \
232 uintptr_t sp = (uintptr_t)&local_stack; 239 uintptr_t sp = (uintptr_t)&local_stack;
233 240
234 // These magic values are written to shadow for better error reporting. 241 // These magic values are written to shadow for better error reporting.
235 const int kAsanHeapLeftRedzoneMagic = 0xfa; 242 const int kAsanHeapLeftRedzoneMagic = 0xfa;
(...skipping 30 matching lines...) Expand all
266 // Requires an external lock. 273 // Requires an external lock.
267 void *Allocate(size_t size); 274 void *Allocate(size_t size);
268 private: 275 private:
269 char *allocated_end_; 276 char *allocated_end_;
270 char *allocated_current_; 277 char *allocated_current_;
271 }; 278 };
272 279
273 } // namespace __asan 280 } // namespace __asan
274 281
275 #endif // ASAN_INTERNAL_H 282 #endif // ASAN_INTERNAL_H
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b