Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: third_party/tcmalloc/chromium/src/stacktrace_x86-inl.h

Issue 9311003: Update the tcmalloc chromium branch to r144 (gperftools 2.0), and merge chromium-specific changes. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebasec Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include <stdint.h> // for uintptr_t 57 #include <stdint.h> // for uintptr_t
58 #endif 58 #endif
59 #ifdef HAVE_UNISTD_H 59 #ifdef HAVE_UNISTD_H
60 #include <unistd.h> 60 #include <unistd.h>
61 #endif 61 #endif
62 #ifdef HAVE_MMAP 62 #ifdef HAVE_MMAP
63 #include <sys/mman.h> // for msync 63 #include <sys/mman.h> // for msync
64 #include "base/vdso_support.h" 64 #include "base/vdso_support.h"
65 #endif 65 #endif
66 66
67 #include "google/stacktrace.h" 67 #include "gperftools/stacktrace.h"
68 #if defined(KEEP_SHADOW_STACKS) 68 #if defined(KEEP_SHADOW_STACKS)
69 #include "linux_shadow_stacks.h" 69 #include "linux_shadow_stacks.h"
70 #endif // KEEP_SHADOW_STACKS 70 #endif // KEEP_SHADOW_STACKS
71 71
72 #if defined(__linux__) && defined(__i386__) && defined(__ELF__) && defined(HAVE_ MMAP) 72 #if defined(__linux__) && defined(__i386__) && defined(__ELF__) && defined(HAVE_ MMAP)
73 // Count "push %reg" instructions in VDSO __kernel_vsyscall(), 73 // Count "push %reg" instructions in VDSO __kernel_vsyscall(),
74 // preceeding "syscall" or "sysenter". 74 // preceeding "syscall" or "sysenter".
75 // If __kernel_vsyscall uses frame pointer, answer 0. 75 // If __kernel_vsyscall uses frame pointer, answer 0.
76 // 76 //
77 // kMaxBytes tells how many instruction bytes of __kernel_vsyscall 77 // kMaxBytes tells how many instruction bytes of __kernel_vsyscall
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 if (STRICT_UNWINDING) { 234 if (STRICT_UNWINDING) {
235 // With the stack growing downwards, older stack frame must be 235 // With the stack growing downwards, older stack frame must be
236 // at a greater address that the current one. 236 // at a greater address that the current one.
237 if (new_sp <= old_sp) return NULL; 237 if (new_sp <= old_sp) return NULL;
238 // Assume stack frames larger than 100,000 bytes are bogus. 238 // Assume stack frames larger than 100,000 bytes are bogus.
239 if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000) return NULL; 239 if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000) return NULL;
240 } else { 240 } else {
241 // In the non-strict mode, allow discontiguous stack frames. 241 // In the non-strict mode, allow discontiguous stack frames.
242 // (alternate-signal-stacks for example). 242 // (alternate-signal-stacks for example).
243 if (new_sp == old_sp) return NULL; 243 if (new_sp == old_sp) return NULL;
244 // And allow frames upto about 1MB. 244 if (new_sp > old_sp) {
245 if ((new_sp > old_sp) 245 // And allow frames upto about 1MB.
246 && ((uintptr_t)new_sp - (uintptr_t)old_sp > 1000000)) return NULL; 246 const uintptr_t delta = (uintptr_t)new_sp - (uintptr_t)old_sp;
247 const uintptr_t acceptable_delta = 1000000;
248 if (delta > acceptable_delta) {
249 return NULL;
250 }
251 }
247 } 252 }
248 if ((uintptr_t)new_sp & (sizeof(void *) - 1)) return NULL; 253 if ((uintptr_t)new_sp & (sizeof(void *) - 1)) return NULL;
249 #ifdef __i386__ 254 #ifdef __i386__
250 // On 64-bit machines, the stack pointer can be very close to 255 // On 64-bit machines, the stack pointer can be very close to
251 // 0xffffffff, so we explicitly check for a pointer into the 256 // 0xffffffff, so we explicitly check for a pointer into the
252 // last two pages in the address space 257 // last two pages in the address space
253 if ((uintptr_t)new_sp >= 0xffffe000) return NULL; 258 if ((uintptr_t)new_sp >= 0xffffe000) return NULL;
254 #endif 259 #endif
255 #ifdef HAVE_MMAP 260 #ifdef HAVE_MMAP
256 if (!STRICT_UNWINDING) { 261 if (!STRICT_UNWINDING) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 n++; 387 n++;
383 continue; 388 continue;
384 } 389 }
385 } 390 }
386 break; 391 break;
387 } 392 }
388 } 393 }
389 #endif // KEEP_SHADOW_STACKS 394 #endif // KEEP_SHADOW_STACKS
390 return n; 395 return n;
391 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698