Changeset 275247 in webkit


Ignore:
Timestamp:
Mar 30, 2021, 4:12:22 PM (4 years ago)
Author:
mark.lam@apple.com
Message:

Add disableForwardingVPrintfStdErrToOSLog() and use it in the jsc shell.
https://bugs.webkit.org/show_bug.cgi?id=223963

Reviewed by Saam Barati.

Source/JavaScriptCore:

This prevents automatic forwarding of vprintf_stderr_common() to os_log_with_args(),
which results in duplicate output when using the jsc shell. As a result, ASSERT
fail messages and crash stack traces will be more readable.

  • jsc.cpp:

(main):

Source/WTF:

  • wtf/Assertions.cpp:

(WTF::disableForwardingVPrintfStdErrToOSLog):

  • wtf/Assertions.h:
  • wtf/WTFConfig.h:
Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r275243 r275247  
     12021-03-30  Mark Lam  <mark.lam@apple.com>
     2
     3        Add disableForwardingVPrintfStdErrToOSLog() and use it in the jsc shell.
     4        https://bugs.webkit.org/show_bug.cgi?id=223963
     5
     6        Reviewed by Saam Barati.
     7
     8        This prevents automatic forwarding of vprintf_stderr_common() to os_log_with_args(),
     9        which results in duplicate output when using the jsc shell.  As a result, ASSERT
     10        fail messages and crash stack traces will be more readable.
     11
     12        * jsc.cpp:
     13        (main):
     14
    1152021-03-30  Mark Lam  <mark.lam@apple.com>
    216
  • trunk/Source/JavaScriptCore/jsc.cpp

    r274724 r275247  
    28252825    // have a chance to parse options.
    28262826    WTF::initialize();
     2827#if PLATFORM(COCOA)
     2828    WTF::disableForwardingVPrintfStdErrToOSLog();
     2829#endif
    28272830
    28282831    // We can't use destructors in the following code because it uses Windows
  • trunk/Source/WTF/ChangeLog

    r275172 r275247  
     12021-03-30  Mark Lam  <mark.lam@apple.com>
     2
     3        Add disableForwardingVPrintfStdErrToOSLog() and use it in the jsc shell.
     4        https://bugs.webkit.org/show_bug.cgi?id=223963
     5
     6        Reviewed by Saam Barati.
     7
     8        * wtf/Assertions.cpp:
     9        (WTF::disableForwardingVPrintfStdErrToOSLog):
     10        * wtf/Assertions.h:
     11        * wtf/WTFConfig.h:
     12
    1132021-03-29  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/WTF/wtf/Assertions.cpp

    r272892 r275247  
    11/*
    2  * Copyright (C) 2003-2019 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2003-2021 Apple Inc.  All rights reserved.
    33 * Copyright (C) 2007-2009 Torch Mobile, Inc.
    44 * Copyright (C) 2011 University of Szeged. All rights reserved.
     
    3838#include <wtf/PrintStream.h>
    3939#include <wtf/StackTrace.h>
     40#include <wtf/WTFConfig.h>
    4041#include <wtf/text/CString.h>
    4142#include <wtf/text/StringBuilder.h>
     
    115116}
    116117
    117 }
     118#if PLATFORM(COCOA)
     119void disableForwardingVPrintfStdErrToOSLog()
     120{
     121    g_wtfConfig.disableForwardingVPrintfStdErrToOSLog = true;
     122}
     123#endif
     124
     125} // namespace WTF
    118126
    119127extern "C" {
     
    148156
    149157#if PLATFORM(COCOA)
    150     va_list copyOfArgs;
    151     va_copy(copyOfArgs, args);
    152     os_log_with_args(OS_LOG_DEFAULT, OS_LOG_TYPE_DEFAULT, format, copyOfArgs, __builtin_return_address(0));
    153     va_end(copyOfArgs);
     158    if (!g_wtfConfig.disableForwardingVPrintfStdErrToOSLog) {
     159        va_list copyOfArgs;
     160        va_copy(copyOfArgs, args);
     161        os_log_with_args(OS_LOG_DEFAULT, OS_LOG_TYPE_DEFAULT, format, copyOfArgs, __builtin_return_address(0));
     162        va_end(copyOfArgs);
     163    }
    154164#endif
    155165
  • trunk/Source/WTF/wtf/Assertions.h

    r272892 r275247  
    681681    isIntegralOrPointerType(types...);
    682682}
    683 }
     683
     684#if PLATFORM(COCOA)
     685WTF_EXPORT_PRIVATE void disableForwardingVPrintfStdErrToOSLog();
     686#endif
     687
     688} // namespace WTF
    684689
    685690inline void compilerFenceForCrash()
  • trunk/Source/WTF/wtf/WTFConfig.h

    r274325 r275247  
    11/*
    2  * Copyright (C) 2020 Apple Inc. All rights reserved.
     2 * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7070
    7171    bool isPermanentlyFrozen;
     72#if PLATFORM(COCOA)
     73    bool disableForwardingVPrintfStdErrToOSLog;
     74#endif
    7275
    7376#if USE(PTHREADS)
Note: See TracChangeset for help on using the changeset viewer.