-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[lldb] Remerge #136236 (Avoid force loading symbols in statistics collection #136795
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
[lldb] Remerge #136236 (Avoid force loading symbols in statistics collection #136795
Conversation
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D73218490
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to update the description to include what you did to fix the test failure (looks like just checking the main module stats).
I think it is also useful to include the original commit description when re-applying a commit since this is the one that will show up most often in a history/blame command and having the full context readily available is useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Watch the buildbot, and please run your tests on both macOS and linux prior to merging to ensure we don't fail. I am a bit worried about system runtime plug-ins causing symbols to be loaded on some configs.
Ran |
Checked |
Fix a test failure in #136236, apply a minor renaming of statistics, and remerge. See details below.
Changes in #136236
Currently,
DebuggerStats::ReportStatistics()
callsModule::GetSymtab(/*can_create=*/false)
, but then the latter callsSymbolFile::GetSymtab()
. This will load symbols if haven't yet. See stacktrace below.The problem is that
DebuggerStats::ReportStatistics
should be read-only. This is especially important because it reports stats for symtab parsing/indexing time, which could be affected by the reporting itself if it's not read-only.This patch fixes this problem by adding an optional parameter
SymbolFile::GetSymtab(bool can_create = true)
and receiving thefalse
value passed down fromModule::GetSymtab(/*can_create=*/false)
when the call is initiated fromDebuggerStats::ReportStatistics()
.Notes about the following stacktrace:
settings set target.preload-symbols false
to~/.lldbinit
, dolldb a.out
, thenstatistics dump
.ObjectFile::GetSymtab
hasllvm::call_once
. So the fact that it called intoObjectFileMachO::ParseSymtab
means that the symbol table is actually being parsed.Changes in this PR top of the above
Fix a test failure in
TestStats.py
. The original version of the added test checks that all modules have symbol count zero whentarget.preload-symbols == false
. The test failed on macOS. Due to various reasons, on macOS, symbols can be loaded for dylibs even with that setting, but not for the main module. For now, the fix of the test is to limit the assertion to only the main module. The test now passes on macOS. In the future, when we have a way to control a specific list of plug-ins to be loaded, there may be a configuration that this test can use to assert that all modules have symbol count zero.Apply a minor renaming of statistics, per the suggestion in #136226 after merge.
Tests
Manually tested with a helloworld program, that:
ObjectFileMachO::ParseSymtab()
is hit when we dolldb a.out
thenstatistics dump
.Unit test: