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

Side by Side Diff: Source/wtf/Assertions.cpp

Issue 337653002: Oilpan: GC_TRACING: Improve object path dump (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Skip WebCore::Persistent frames automatically Created 6 years, 6 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
« no previous file with comments | « Source/wtf/Assertions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007-2009 Torch Mobile, Inc. 3 * Copyright (C) 2007-2009 Torch Mobile, Inc.
4 * Copyright (C) 2011 University of Szeged. All rights reserved. 4 * Copyright (C) 2011 University of Szeged. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 { 255 {
256 static const int framesToSkip = 2; 256 static const int framesToSkip = 2;
257 // Use alloca to allocate on the stack since this function is used in OOM si tuations. 257 // Use alloca to allocate on the stack since this function is used in OOM si tuations.
258 void** samples = static_cast<void**>(alloca((framesToShow + framesToSkip) * sizeof(void *))); 258 void** samples = static_cast<void**>(alloca((framesToShow + framesToSkip) * sizeof(void *)));
259 int frames = framesToShow + framesToSkip; 259 int frames = framesToShow + framesToSkip;
260 260
261 WTFGetBacktrace(samples, &frames); 261 WTFGetBacktrace(samples, &frames);
262 WTFPrintBacktrace(samples + framesToSkip, frames - framesToSkip); 262 WTFPrintBacktrace(samples + framesToSkip, frames - framesToSkip);
263 } 263 }
264 264
265 FrameToNameScope::FrameToNameScope(void* addr)
266 : m_name(0)
267 , m_cxaDemangled(0)
268 {
269 #if OS(MACOSX) || (OS(LINUX) && !defined(__UCLIBC__))
270 Dl_info info;
271 if (!dladdr(addr, &info) || !info.dli_sname)
272 return;
273 const char* mangledName = info.dli_sname;
274 if ((m_cxaDemangled = abi::__cxa_demangle(mangledName, 0, 0, 0)))
275 m_name = m_cxaDemangled;
276 else
277 m_name = mangledName;
278 #else
279 (void)addr;
280 #endif
281 }
282
283 FrameToNameScope::~FrameToNameScope()
284 {
285 free(m_cxaDemangled);
286 }
287
265 void WTFPrintBacktrace(void** stack, int size) 288 void WTFPrintBacktrace(void** stack, int size)
266 { 289 {
267 for (int i = 0; i < size; ++i) { 290 for (int i = 0; i < size; ++i) {
268 const char* mangledName = 0; 291 FrameToNameScope frameToName(stack[i]);
269 char* cxaDemangled = 0;
270 #if OS(MACOSX) || (OS(LINUX) && !defined(__UCLIBC__))
271 Dl_info info;
272 if (dladdr(stack[i], &info) && info.dli_sname)
273 mangledName = info.dli_sname;
274 if (mangledName)
275 cxaDemangled = abi::__cxa_demangle(mangledName, 0, 0, 0);
276 #endif
277 const int frameNumber = i + 1; 292 const int frameNumber = i + 1;
278 if (mangledName || cxaDemangled) 293 if (frameToName.nullableName())
279 printf_stderr_common("%-3d %p %s\n", frameNumber, stack[i], cxaDeman gled ? cxaDemangled : mangledName); 294 printf_stderr_common("%-3d %p %s\n", frameNumber, stack[i], frameToN ame.nullableName());
280 else 295 else
281 printf_stderr_common("%-3d %p\n", frameNumber, stack[i]); 296 printf_stderr_common("%-3d %p\n", frameNumber, stack[i]);
282 free(cxaDemangled);
283 } 297 }
284 } 298 }
285 299
286 static WTFCrashHookFunction globalHook = 0; 300 static WTFCrashHookFunction globalHook = 0;
287 301
288 void WTFSetCrashHook(WTFCrashHookFunction function) 302 void WTFSetCrashHook(WTFCrashHookFunction function)
289 { 303 {
290 globalHook = function; 304 globalHook = function;
291 } 305 }
292 306
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 392
379 void WTFLogAlways(const char* format, ...) 393 void WTFLogAlways(const char* format, ...)
380 { 394 {
381 va_list args; 395 va_list args;
382 va_start(args, format); 396 va_start(args, format);
383 vprintf_stderr_with_trailing_newline(format, args); 397 vprintf_stderr_with_trailing_newline(format, args);
384 va_end(args); 398 va_end(args);
385 } 399 }
386 400
387 } // extern "C" 401 } // extern "C"
OLDNEW
« no previous file with comments | « Source/wtf/Assertions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698