Skip to content

Don't search for separate debug files for mach-o object files #81041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

jimingham
Copy link
Collaborator

mach-o object files never have separate debug info, and in a big app there can be quite a large number of object files, so even a few stats per object file can slow launches considerably.
This patch avoids this search for Mach-o symbol files of object type.

I don't have a way to test this, the only effect is that you didn't do a bunch of stats that weren't going to do any good anyway.

mach-o object files never have separate debug info, and in a big app
there can be quite a large number of object files, so even a few stats
per object file can slow launches considerably.
This patch avoids this search for Mach-o symbol files of object type.

I don't have a way to test this, the only effect is that you didn't do
a bunch of stats that weren't going to do any good anyway.
@llvmbot
Copy link
Member

llvmbot commented Feb 7, 2024

@llvm/pr-subscribers-lldb

Author: None (jimingham)

Changes

mach-o object files never have separate debug info, and in a big app there can be quite a large number of object files, so even a few stats per object file can slow launches considerably.
This patch avoids this search for Mach-o symbol files of object type.

I don't have a way to test this, the only effect is that you didn't do a bunch of stats that weren't going to do any good anyway.


Full diff: https://github.com/llvm/llvm-project/pull/81041.diff

1 Files Affected:

  • (modified) lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (+7-1)
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index 47fe0020ce18d..4080a31224a41 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -118,7 +118,13 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
     FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec());
 
     ObjectFileSP dsym_objfile_sp;
-    if (!dsym_fspec) {
+    // On Darwin, we store the debug information either in object files,
+    // using the debug map to tie them to the executable, or in a dSYM.  We
+    // pass through this routine both for binaries and for .o files, but in the
+    // latter case there will never be an external debug file.  So we shouldn't
+    // do all the stats needed to find it.
+    if (!dsym_fspec && module_sp->GetObjectFile()->CalculateType() 
+        != ObjectFile::eTypeObjectFile) {
       // No symbol file was specified in the module, lets try and find one
       // ourselves.
       FileSpec file_spec = obj_file->GetFileSpec();

Copy link

github-actions bot commented Feb 7, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 369b82218419a0218400e7483255523b8dfd6cf0 b2e7c7e8b342e13b457dcf7da40040f2373c7a3d -- lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
View the diff from clang-format here.
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index f46bff8f7d..70228f0643 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -124,7 +124,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
     // latter case there will never be an external debug file.  So we shouldn't
     // do all the stats needed to find it.
     if (!dsym_fspec && module_sp->GetObjectFile()->CalculateType() !=
-        ObjectFile::eTypeObjectFile) {
+                           ObjectFile::eTypeObjectFile) {
       // No symbol file was specified in the module, lets try and find one
       // ourselves.
       FileSpec file_spec = obj_file->GetFileSpec();

Copy link
Collaborator

@jasonmolenda jasonmolenda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jimingham jimingham merged commit 50ffc53 into llvm:main Feb 7, 2024
@jimingham jimingham deleted the macho-object-files branch February 7, 2024 22:25
jimingham added a commit to jimingham/from-apple-llvm-project that referenced this pull request Feb 7, 2024
…1041)

mach-o object files never have separate debug info, and in a big app
there can be quite a large number of object files, so even a few stats
per object file can slow launches considerably.
This patch avoids this search for Mach-o symbol files of object type.

I don't have a way to test this, the only effect is that you didn't do a
bunch of stats that weren't going to do any good anyway.

(cherry picked from commit 50ffc53)
jimingham added a commit to jimingham/from-apple-llvm-project that referenced this pull request Feb 7, 2024
…1041)

mach-o object files never have separate debug info, and in a big app
there can be quite a large number of object files, so even a few stats
per object file can slow launches considerably.
This patch avoids this search for Mach-o symbol files of object type.

I don't have a way to test this, the only effect is that you didn't do a
bunch of stats that weren't going to do any good anyway.

(cherry picked from commit 50ffc53)
// On Darwin, we store the debug information either in object files,
// using the debug map to tie them to the executable, or in a dSYM. We
// pass through this routine both for binaries and for .o files, but in the
// latter case there will never be an external debug file. So we shouldn't
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does "external debug file" in this context mean dwo?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I think I get it. This is looking up a dSYM by UUID.
LGTM

JDevlieghere added a commit to swiftlang/llvm-project that referenced this pull request Feb 8, 2024
Don't search for separate debug files for mach-o object files (llvm#81041)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants