[PATCH] D145521: [memprof] Update the isRuntime symbolization check.

Snehasish Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 12:16:35 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbcebadeba75f: [memprof] Update the isRuntime symbolization check. (authored by snehasish).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145521/new/

https://reviews.llvm.org/D145521

Files:
  llvm/lib/ProfileData/RawMemProfReader.cpp
  llvm/unittests/ProfileData/MemProfTest.cpp


Index: llvm/unittests/ProfileData/MemProfTest.cpp
===================================================================
--- llvm/unittests/ProfileData/MemProfTest.cpp
+++ llvm/unittests/ProfileData/MemProfTest.cpp
@@ -321,14 +321,23 @@
                                                 specifier(), false))
       .Times(1)
       .WillRepeatedly(Return(makeInliningInfo({
-          {"foo", 10, 5, 30},
+          {"foo", 10, 5, 30, "memprof/memprof_test_file.cpp"},
+      })));
+
+  EXPECT_CALL(*Symbolizer, symbolizeInlinedCode(SectionedAddress{0x5000},
+                                                specifier(), false))
+      .Times(1)
+      .WillRepeatedly(Return(makeInliningInfo({
+          // Depending on how the runtime was compiled, only the filename
+          // may be present in the debug information.
+          {"malloc", 70, 57, 3, "memprof_malloc_linux.cpp"},
       })));
 
   CallStackMap CSM;
   CSM[0x1] = {0x1000, 0x2000, 0x3000, 0x4000};
   // This entry should be dropped since all PCs are either not
   // symbolizable or belong to the runtime.
-  CSM[0x2] = {0x1000, 0x2000};
+  CSM[0x2] = {0x1000, 0x2000, 0x5000};
 
   llvm::MapVector<uint64_t, MemInfoBlock> Prof;
   Prof[0x1].AllocCount = 1;
Index: llvm/lib/ProfileData/RawMemProfReader.cpp
===================================================================
--- llvm/lib/ProfileData/RawMemProfReader.cpp
+++ llvm/lib/ProfileData/RawMemProfReader.cpp
@@ -149,8 +149,12 @@
 }
 
 bool isRuntimePath(const StringRef Path) {
-  return StringRef(llvm::sys::path::convert_to_slash(Path))
-      .contains("memprof/memprof_");
+  const StringRef Filename = llvm::sys::path::filename(Path);
+  // This list should be updated in case new files with additional interceptors
+  // are added to the memprof runtime.
+  return Filename.equals("memprof_malloc_linux.cpp") ||
+         Filename.equals("memprof_interceptors.cpp") ||
+         Filename.equals("memprof_new_delete.cpp");
 }
 
 std::string getBuildIdString(const SegmentEntry &Entry) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145521.503128.patch
Type: text/x-patch
Size: 2021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230307/6dbc2699/attachment.bin>


More information about the llvm-commits mailing list