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

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

Issue 9702045: Update the tcmalloc vendor branch to r144 (gperftools 2.0), and README.chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 68
69 #if defined(__linux__) && defined(__i386__) && defined(__ELF__) && defined(HAVE_ MMAP) 69 #if defined(__linux__) && defined(__i386__) && defined(__ELF__) && defined(HAVE_ MMAP)
70 // Count "push %reg" instructions in VDSO __kernel_vsyscall(), 70 // Count "push %reg" instructions in VDSO __kernel_vsyscall(),
71 // preceeding "syscall" or "sysenter". 71 // preceeding "syscall" or "sysenter".
72 // If __kernel_vsyscall uses frame pointer, answer 0. 72 // If __kernel_vsyscall uses frame pointer, answer 0.
73 // 73 //
74 // kMaxBytes tells how many instruction bytes of __kernel_vsyscall 74 // kMaxBytes tells how many instruction bytes of __kernel_vsyscall
75 // to analyze before giving up. Up to kMaxBytes+1 bytes of 75 // to analyze before giving up. Up to kMaxBytes+1 bytes of
76 // instructions could be accessed. 76 // instructions could be accessed.
77 // 77 //
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 if (STRICT_UNWINDING) { 231 if (STRICT_UNWINDING) {
232 // With the stack growing downwards, older stack frame must be 232 // With the stack growing downwards, older stack frame must be
233 // at a greater address that the current one. 233 // at a greater address that the current one.
234 if (new_sp <= old_sp) return NULL; 234 if (new_sp <= old_sp) return NULL;
235 // Assume stack frames larger than 100,000 bytes are bogus. 235 // Assume stack frames larger than 100,000 bytes are bogus.
236 if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000) return NULL; 236 if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000) return NULL;
237 } else { 237 } else {
238 // In the non-strict mode, allow discontiguous stack frames. 238 // In the non-strict mode, allow discontiguous stack frames.
239 // (alternate-signal-stacks for example). 239 // (alternate-signal-stacks for example).
240 if (new_sp == old_sp) return NULL; 240 if (new_sp == old_sp) return NULL;
241 // And allow frames upto about 1MB. 241 if (new_sp > old_sp) {
242 if ((new_sp > old_sp) 242 // And allow frames upto about 1MB.
243 && ((uintptr_t)new_sp - (uintptr_t)old_sp > 1000000)) return NULL; 243 const uintptr_t delta = (uintptr_t)new_sp - (uintptr_t)old_sp;
244 const uintptr_t acceptable_delta = 1000000;
245 if (delta > acceptable_delta) {
246 return NULL;
247 }
248 }
244 } 249 }
245 if ((uintptr_t)new_sp & (sizeof(void *) - 1)) return NULL; 250 if ((uintptr_t)new_sp & (sizeof(void *) - 1)) return NULL;
246 #ifdef __i386__ 251 #ifdef __i386__
247 // On 64-bit machines, the stack pointer can be very close to 252 // On 64-bit machines, the stack pointer can be very close to
248 // 0xffffffff, so we explicitly check for a pointer into the 253 // 0xffffffff, so we explicitly check for a pointer into the
249 // last two pages in the address space 254 // last two pages in the address space
250 if ((uintptr_t)new_sp >= 0xffffe000) return NULL; 255 if ((uintptr_t)new_sp >= 0xffffe000) return NULL;
251 #endif 256 #endif
252 #ifdef HAVE_MMAP 257 #ifdef HAVE_MMAP
253 if (!STRICT_UNWINDING) { 258 if (!STRICT_UNWINDING) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // A frame-size of 0 is used to indicate unknown frame size. 342 // A frame-size of 0 is used to indicate unknown frame size.
338 sizes[n] = 0; 343 sizes[n] = 0;
339 } 344 }
340 #endif 345 #endif
341 n++; 346 n++;
342 } 347 }
343 sp = next_sp; 348 sp = next_sp;
344 } 349 }
345 return n; 350 return n;
346 } 351 }
OLDNEW
« no previous file with comments | « third_party/tcmalloc/vendor/src/stacktrace_win32-inl.h ('k') | third_party/tcmalloc/vendor/src/stacktrace_x86_64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698