https://github.com/snehasish requested changes to this pull request.
It would be nice to split this patch into at least two parts:
1. Add basic support for Darwin (malloc implementation, build ids, raw format
etc)
2. Record and dump references to static data in the binary
I think there are a
@@ -78,7 +78,11 @@ static int GetCpuId(void) {
// will seg fault as the address of __vdso_getcpu will be null.
if (!memprof_inited)
return -1;
+#if SANITIZER_APPLE
+ return 0;
teresajohnson wrote:
If there is a way to do this on Apple then add a
@@ -0,0 +1,83 @@
+// UNSUPPORTED: ios
+
+// RUN: %clangxx_memprof -O0 %s -o %t
+// RUN:
%env_memprof_opts=print_binary_refs=true:print_text=true:log_path=stdout:verbosity=2
%run %t &> %t.log
+// RUN: llvm-nm %t &> %t2.log
+// RUN: cat %t2.log %t.log | FileCheck %s
+
+#include
@@ -747,8 +749,10 @@ endif()
if (OS_NAME MATCHES "Linux|FreeBSD|Windows|NetBSD|SunOS")
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
+ set(COMPILER_RT_MEMPROF_HAS_STATIC_RUNTIME TRUE)
else()
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
+
@@ -279,13 +286,54 @@ struct Allocator {
Print(Value->mib, Key, bool(Arg));
}
+ using SegmentEntry = ::llvm::memprof::SegmentEntry;
void FinishAndWrite() {
if (print_text && common_flags()->print_module_map)
DumpProcessMap();
@@ -0,0 +1,83 @@
+// UNSUPPORTED: ios
+
+// RUN: %clangxx_memprof -O0 %s -o %t
+// RUN:
%env_memprof_opts=print_binary_refs=true:print_text=true:log_path=stdout:verbosity=2
%run %t &> %t.log
+// RUN: llvm-nm %t &> %t2.log
+// RUN: cat %t2.log %t.log | FileCheck %s
+
+#include
@@ -63,6 +57,23 @@ struct AP64 { // Allocator64 parameters. Deliberately using
a short name.
template
using PrimaryAllocatorASVT = SizeClassAllocator64>;
using PrimaryAllocator = PrimaryAllocatorASVT;
+#endif
teresajohnson wrote:
Combine these 2 lines into
@@ -43,6 +43,7 @@ enum class align_val_t : size_t {};
ReportOutOfMemory(size, );
\
return res;
+#if !SANITIZER_APPLE
teresajohnson wrote:
How do operator new and delete get intercepted on Apple?
Also, are
@@ -279,13 +286,54 @@ struct Allocator {
Print(Value->mib, Key, bool(Arg));
}
+ using SegmentEntry = ::llvm::memprof::SegmentEntry;
void FinishAndWrite() {
if (print_text && common_flags()->print_module_map)
DumpProcessMap();
https://github.com/teresajohnson commented:
Thanks for sending the patch! I took an initial look through and have some
comments/questions.
@snehasish may also be interested in taking a look.
https://github.com/llvm/llvm-project/pull/69640
___
https://github.com/teresajohnson edited
https://github.com/llvm/llvm-project/pull/69640
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/manman-ren edited
https://github.com/llvm/llvm-project/pull/69640
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff ea9e116e5a24e834142bc4024b57697b48599a9e
8ce32592e780e693a9378f30237a25629a822897 --
https://github.com/manman-ren created
https://github.com/llvm/llvm-project/pull/69640
None
>From 86dc0db55bf6aa629639b1beac5c2cf5f39177ec Mon Sep 17 00:00:00 2001
From: Manman Ren
Date: Tue, 10 Oct 2023 20:54:07 -0700
Subject: [PATCH 1/2] memprof support on Darwin
---
14 matches
Mail list logo