-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[lldb] Fix the DWARF index cache when index is partial. #118390
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // REQUIRES: lld | ||
|
|
||
| // Test if we build a mixed binary where one .o file has a .debug_names and | ||
| // another doesn't have one, that we save a full or partial index cache. | ||
| // Previous versions of LLDB would have ManualDWARFIndex.cpp that would save out | ||
| // an index cache to the same file regardless of wether the index cache was a | ||
| // full DWARF manual index, or just the CUs and TUs that were missing from any | ||
| // .debug_names tables. If the user had a .debug_names table and debugged once | ||
| // with index caching enabled, then debugged again but set the setting to ignore | ||
| // .debug_names ('settings set plugin.symbol-file.dwarf.ignore-file-indexes 1') | ||
| // this could cause LLDB to load the index cache from the previous run which | ||
| // was incomplete and it only contained the manually indexed DWARF from the run | ||
| // where we used .debug_names, but it would now load it as if it were the | ||
| // complete DWARF index. | ||
|
|
||
| // Test that if we don't have .debug_names, that we save a full DWARF index. | ||
| // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=1 -c %s -o %t.main.o | ||
| // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=0 -c %s -o %t.foo.o | ||
| // RUN: ld.lld %t.main.o %t.foo.o -o %t.nonames | ||
| // RUN: llvm-dwp %t.main.dwo %t.foo.dwo -o %t.nonames.dwp | ||
| // RUN: rm %t.main.dwo %t.foo.dwo | ||
| // Run one time with the index cache enabled to populate the index cache. When | ||
| // we populate the index cache we have to parse all of the DWARF debug info | ||
| // and it is always available. | ||
| // RUN: rm -rf %t.lldb-index-cache | ||
| // RUN: %lldb \ | ||
| // RUN: -O 'settings set symbols.enable-lldb-index-cache true' \ | ||
| // RUN: -O 'settings set symbols.lldb-index-cache-path %t.lldb-index-cache' \ | ||
| // RUN: -O 'settings set target.preload-symbols true' \ | ||
| // RUN: %t.nonames -b | ||
|
|
||
| // Make sure there is a file with "dwarf-index-full" in its filename | ||
| // RUN: ls %t.lldb-index-cache | FileCheck %s -check-prefix=FULL | ||
| // FULL: {{dwp-index-cache.cpp.tmp.nonames.*-dwarf-index-full-}} | ||
|
|
||
| // Test that if we have one .o file with .debug_names and one without, that we | ||
| // save a partial DWARF index. | ||
| // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=1 -c %s -o %t.main.o -gpubnames | ||
| // RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -DMAIN=0 -c %s -o %t.foo.o | ||
| // RUN: ld.lld %t.main.o %t.foo.o -o %t.somenames | ||
| // RUN: llvm-dwp %t.main.dwo %t.foo.dwo -o %t.somenames.dwp | ||
| // RUN: rm %t.main.dwo %t.foo.dwo | ||
|
Comment on lines
+41
to
+42
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| // Run one time with the index cache enabled to populate the index cache. When | ||
| // we populate the index cache we have to parse all of the DWARF debug info | ||
| // and it is always available. | ||
| // RUN: rm -rf %t.lldb-index-cache | ||
| // RUN: %lldb \ | ||
| // RUN: -O 'settings set symbols.enable-lldb-index-cache true' \ | ||
| // RUN: -O 'settings set symbols.lldb-index-cache-path %t.lldb-index-cache' \ | ||
| // RUN: -O 'settings set target.preload-symbols true' \ | ||
| // RUN: %t.somenames -b | ||
|
|
||
| // Make sure there is a file with "dwarf-index-full" in its filename | ||
| // RUN: ls %t.lldb-index-cache | FileCheck %s -check-prefix=PARTIAL | ||
| // PARTIAL: {{dwp-index-cache.cpp.tmp.somenames.*-dwarf-index-partial-}} | ||
|
|
||
| #if MAIN | ||
| extern int foo(); | ||
| int main() { return foo(); } | ||
| #else | ||
| int foo() { return 0; } | ||
| #endif | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are these steps necessary. We should be able to build/save the index from dwo files alone, right?