[clang] Support MemProf on darwin (PR #69640)

Teresa Johnson via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 26 20:17:51 PDT 2023


================
@@ -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();
 
     allocator.ForceLock();
 
     InsertLiveBlocks();
+#if SANITIZER_APPLE
+    if (print_binary_refs) {
+      __sanitizer::ListOfModules List;
+      List.init();
+      ArrayRef<LoadedModule> Modules(List.begin(), List.end());
+      for (const auto &Module : Modules) {
+        for (const auto &Segment : Module.ranges()) {
+          if (true) { // Segment.executable) {
+            SegmentEntry Entry(Segment.beg, Segment.end, Module.base_address());
+            // CHECK(Module.uuid_size() <= MEMPROF_BUILDID_MAX_SIZE);
----------------
teresajohnson wrote:

Should this check and the line below it be uncommented?

https://github.com/llvm/llvm-project/pull/69640


More information about the cfe-commits mailing list