OLD | NEW |
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 { | 272 { |
273 static const int framesToShow = 31; | 273 static const int framesToShow = 31; |
274 static const int framesToSkip = 2; | 274 static const int framesToSkip = 2; |
275 void* samples[framesToShow + framesToSkip]; | 275 void* samples[framesToShow + framesToSkip]; |
276 int frames = framesToShow + framesToSkip; | 276 int frames = framesToShow + framesToSkip; |
277 | 277 |
278 WTFGetBacktrace(samples, &frames); | 278 WTFGetBacktrace(samples, &frames); |
279 WTFPrintBacktrace(samples + framesToSkip, frames - framesToSkip); | 279 WTFPrintBacktrace(samples + framesToSkip, frames - framesToSkip); |
280 } | 280 } |
281 | 281 |
282 #if OS(DARWIN) || OS(LINUX) | 282 #if OS(DARWIN) || (OS(LINUX) && !OS(ANDROID)) |
283 # if PLATFORM(QT) || PLATFORM(GTK) | 283 #define WTF_USE_DLADDR 1 |
284 # if defined(__GLIBC__) && !defined(__UCLIBC__) | |
285 # define WTF_USE_BACKTRACE_SYMBOLS 1 | |
286 # endif | |
287 # elif !OS(ANDROID) | |
288 # define WTF_USE_DLADDR 1 | |
289 # endif | |
290 #endif | 284 #endif |
291 | 285 |
292 void WTFPrintBacktrace(void** stack, int size) | 286 void WTFPrintBacktrace(void** stack, int size) |
293 { | 287 { |
294 #if USE(BACKTRACE_SYMBOLS) | 288 #if USE(BACKTRACE_SYMBOLS) |
295 char** symbols = backtrace_symbols(stack, size); | 289 char** symbols = backtrace_symbols(stack, size); |
296 if (!symbols) | 290 if (!symbols) |
297 return; | 291 return; |
298 #endif | 292 #endif |
299 | 293 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 414 |
421 void WTFLogAlways(const char* format, ...) | 415 void WTFLogAlways(const char* format, ...) |
422 { | 416 { |
423 va_list args; | 417 va_list args; |
424 va_start(args, format); | 418 va_start(args, format); |
425 vprintf_stderr_with_trailing_newline(format, args); | 419 vprintf_stderr_with_trailing_newline(format, args); |
426 va_end(args); | 420 va_end(args); |
427 } | 421 } |
428 | 422 |
429 } // extern "C" | 423 } // extern "C" |
OLD | NEW |