Changeset 223936 in webkit


Ignore:
Timestamp:
Oct 24, 2017 3:30:15 PM (6 years ago)
Author:
ddkilzer@apple.com
Message:

Need to pass non-nil argument to SimulateCrash() in bmalloc::logVMFailure()
<https://webkit.org/b/178740>
<rdar://problem/35154943>

Reviewed by Saam Barati.

  • bmalloc/BPlatform.h:

(BUNUSED_PARAM): Define macro.

  • bmalloc/Logging.cpp:

(SimulateCrash): Change third argument of SimulateCrash() to
CFStringRef since it's an NSString * in Objective-C.
(bmalloc::logVMFailure): Create a CFStringRef to use as a
description string. Use new vmSize parameter to log size.

  • bmalloc/Logging.h:

(bmalloc::logVMFailure): Update function signature to take a
size_t parameter representing vmSize.

  • bmalloc/VMAllocate.h:

(bmalloc::tryVMAllocate): Pass vmSize into logVMFailure().

Location:
trunk/Source/bmalloc
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/ChangeLog

    r223877 r223936  
     12017-10-24  David Kilzer  <ddkilzer@apple.com>
     2
     3        Need to pass non-nil argument to SimulateCrash() in bmalloc::logVMFailure()
     4        <https://webkit.org/b/178740>
     5        <rdar://problem/35154943>
     6
     7        Reviewed by Saam Barati.
     8
     9        * bmalloc/BPlatform.h:
     10        (BUNUSED_PARAM): Define macro.
     11        * bmalloc/Logging.cpp:
     12        (SimulateCrash): Change third argument of SimulateCrash() to
     13        CFStringRef since it's an NSString * in Objective-C.
     14        (bmalloc::logVMFailure): Create a CFStringRef to use as a
     15        description string.  Use new vmSize parameter to log size.
     16        * bmalloc/Logging.h:
     17        (bmalloc::logVMFailure): Update function signature to take a
     18        size_t parameter representing vmSize.
     19        * bmalloc/VMAllocate.h:
     20        (bmalloc::tryVMAllocate): Pass vmSize into logVMFailure().
     21
    1222017-10-23  Michael Catanzaro  <mcatanzaro@igalia.com>
    223
  • trunk/Source/bmalloc/bmalloc/BPlatform.h

    r221548 r223936  
    217217#define BUSE_OS_LOG 1
    218218#endif
     219
     220/* BUNUSED_PARAM */
     221#if !defined(BUNUSED_PARAM)
     222#define BUNUSED_PARAM(variable) (void)variable
     223#endif
  • trunk/Source/bmalloc/bmalloc/Logging.cpp

    r201983 r223936  
    3333
    3434#if BPLATFORM(IOS)
     35#include <CoreFoundation/CoreFoundation.h>
    3536#include <mach/exception_types.h>
    3637#include <objc/objc.h>
     
    3940#include "BSoftLinking.h"
    4041BSOFT_LINK_PRIVATE_FRAMEWORK(CrashReporterSupport);
    41 BSOFT_LINK_FUNCTION(CrashReporterSupport, SimulateCrash, BOOL, (pid_t pid, mach_exception_data_type_t exceptionCode, id description), (pid, exceptionCode, description));
     42BSOFT_LINK_FUNCTION(CrashReporterSupport, SimulateCrash, BOOL, (pid_t pid, mach_exception_data_type_t exceptionCode, CFStringRef description), (pid, exceptionCode, description));
    4243#endif
    4344
    4445namespace bmalloc {
    4546
    46 void logVMFailure()
     47void logVMFailure(size_t vmSize)
    4748{
    4849#if BPLATFORM(IOS)
    4950    const mach_exception_data_type_t kExceptionCode = 0xc105ca11;
    50     SimulateCrash(getpid(), kExceptionCode, nullptr);
     51    CFStringRef description = CFStringCreateWithFormat(kCFAllocatorDefault, nullptr, CFSTR("bmalloc failed to mmap %lu bytes"), vmSize);
     52    SimulateCrash(getpid(), kExceptionCode, description);
     53    CFRelease(description);
     54#else
     55    BUNUSED_PARAM(vmSize);
    5156#endif
    5257}
  • trunk/Source/bmalloc/bmalloc/Logging.h

    r201969 r223936  
    2727
    2828#include "BPlatform.h"
     29#include <stddef.h>
    2930
    3031namespace bmalloc {
    3132
    32 void logVMFailure();
     33void logVMFailure(size_t vmSize);
    3334
    3435#if !BUSE(OS_LOG)
  • trunk/Source/bmalloc/bmalloc/VMAllocate.h

    r221548 r223936  
    124124    void* result = mmap(0, vmSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | BMALLOC_NORESERVE, BMALLOC_VM_TAG, 0);
    125125    if (result == MAP_FAILED) {
    126         logVMFailure();
     126        logVMFailure(vmSize);
    127127        return nullptr;
    128128    }
Note: See TracChangeset for help on using the changeset viewer.