- Revision
- 223936
- Author
- ddkil...@apple.com
- Date
- 2017-10-24 15:30:15 -0700 (Tue, 24 Oct 2017)
Log 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().
Modified Paths
Diff
Modified: trunk/Source/bmalloc/ChangeLog (223935 => 223936)
--- trunk/Source/bmalloc/ChangeLog 2017-10-24 22:28:44 UTC (rev 223935)
+++ trunk/Source/bmalloc/ChangeLog 2017-10-24 22:30:15 UTC (rev 223936)
@@ -1,3 +1,24 @@
+2017-10-24 David Kilzer <ddkil...@apple.com>
+
+ 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().
+
2017-10-23 Michael Catanzaro <mcatanz...@igalia.com>
Unreviewed, roll out r222731
Modified: trunk/Source/bmalloc/bmalloc/BPlatform.h (223935 => 223936)
--- trunk/Source/bmalloc/bmalloc/BPlatform.h 2017-10-24 22:28:44 UTC (rev 223935)
+++ trunk/Source/bmalloc/bmalloc/BPlatform.h 2017-10-24 22:30:15 UTC (rev 223936)
@@ -216,3 +216,8 @@
#if (BPLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || BPLATFORM(IOS)
#define BUSE_OS_LOG 1
#endif
+
+/* BUNUSED_PARAM */
+#if !defined(BUNUSED_PARAM)
+#define BUNUSED_PARAM(variable) (void)variable
+#endif
Modified: trunk/Source/bmalloc/bmalloc/Logging.cpp (223935 => 223936)
--- trunk/Source/bmalloc/bmalloc/Logging.cpp 2017-10-24 22:28:44 UTC (rev 223935)
+++ trunk/Source/bmalloc/bmalloc/Logging.cpp 2017-10-24 22:30:15 UTC (rev 223936)
@@ -32,6 +32,7 @@
#endif
#if BPLATFORM(IOS)
+#include <CoreFoundation/CoreFoundation.h>
#include <mach/exception_types.h>
#include <objc/objc.h>
#include <unistd.h>
@@ -38,16 +39,20 @@
#include "BSoftLinking.h"
BSOFT_LINK_PRIVATE_FRAMEWORK(CrashReporterSupport);
-BSOFT_LINK_FUNCTION(CrashReporterSupport, SimulateCrash, BOOL, (pid_t pid, mach_exception_data_type_t exceptionCode, id description), (pid, exceptionCode, description));
+BSOFT_LINK_FUNCTION(CrashReporterSupport, SimulateCrash, BOOL, (pid_t pid, mach_exception_data_type_t exceptionCode, CFStringRef description), (pid, exceptionCode, description));
#endif
namespace bmalloc {
-void logVMFailure()
+void logVMFailure(size_t vmSize)
{
#if BPLATFORM(IOS)
const mach_exception_data_type_t kExceptionCode = 0xc105ca11;
- SimulateCrash(getpid(), kExceptionCode, nullptr);
+ CFStringRef description = CFStringCreateWithFormat(kCFAllocatorDefault, nullptr, CFSTR("bmalloc failed to mmap %lu bytes"), vmSize);
+ SimulateCrash(getpid(), kExceptionCode, description);
+ CFRelease(description);
+#else
+ BUNUSED_PARAM(vmSize);
#endif
}
Modified: trunk/Source/bmalloc/bmalloc/Logging.h (223935 => 223936)
--- trunk/Source/bmalloc/bmalloc/Logging.h 2017-10-24 22:28:44 UTC (rev 223935)
+++ trunk/Source/bmalloc/bmalloc/Logging.h 2017-10-24 22:30:15 UTC (rev 223936)
@@ -26,10 +26,11 @@
#pragma once
#include "BPlatform.h"
+#include <stddef.h>
namespace bmalloc {
-void logVMFailure();
+void logVMFailure(size_t vmSize);
#if !BUSE(OS_LOG)
void reportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* format, ...) BATTRIBUTE_PRINTF(4, 5);
Modified: trunk/Source/bmalloc/bmalloc/VMAllocate.h (223935 => 223936)
--- trunk/Source/bmalloc/bmalloc/VMAllocate.h 2017-10-24 22:28:44 UTC (rev 223935)
+++ trunk/Source/bmalloc/bmalloc/VMAllocate.h 2017-10-24 22:30:15 UTC (rev 223936)
@@ -123,7 +123,7 @@
vmValidate(vmSize);
void* result = mmap(0, vmSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | BMALLOC_NORESERVE, BMALLOC_VM_TAG, 0);
if (result == MAP_FAILED) {
- logVMFailure();
+ logVMFailure(vmSize);
return nullptr;
}
return result;