-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[LLDB] Fix debuginfo ELF files overwriting Unified Section List #166635
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 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d0ca47b
Add static function to SectionList to support merging, and implementi…
Jlalond 257b149
Refactor to call module's warning function
Jlalond cb40c99
Add new test and fix bug with IDs
Jlalond f7763af
Fix accidental formatting
Jlalond 19c54b9
only test Nix hosts and run formatters again
Jlalond b76fad2
Fix comment
Jlalond bf0c366
Manual py formatting fix
Jlalond 87e9249
Implement feedback from Greg and test the variety of merge cases with…
Jlalond ae18f13
Fix shell test because we were taking rhs on equals
Jlalond 98581d9
Added a new yaml to test equality by creating a different value to co…
Jlalond 9692c6a
Switch from shared_ptr to just a local
Jlalond 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
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,5 @@ | ||
| CXX_SOURCES := main.cpp | ||
|
|
||
| SPLIT_DEBUG_SYMBOLS := YES | ||
|
|
||
| include Makefile.rules |
51 changes: 51 additions & 0 deletions
51
lldb/test/API/python_api/unified_section_list/TestModuleUnifiedSectionList.py
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,51 @@ | ||
| """ | ||
| Test Unified Section List merging. | ||
| """ | ||
|
|
||
| import os | ||
|
|
||
| import lldb | ||
| from lldbsuite.test.decorators import * | ||
| from lldbsuite.test.lldbtest import * | ||
| from lldbsuite.test import lldbutil | ||
| from lldbsuite.test.lldbutil import symbol_type_to_str | ||
|
|
||
|
|
||
| class ModuleUnifiedSectionList(TestBase): | ||
| @skipUnlessPlatform(["linux", "freebsd", "netbsd"]) | ||
| def test_unified_section_list(self): | ||
| self.build() | ||
| exe = self.getBuildArtifact("a.out") | ||
| debug_info = self.getBuildArtifact("a.out.debug") | ||
| new_dir = os.path.join(os.path.dirname(debug_info), "new_dir") | ||
| os.mkdir(new_dir) | ||
| renamed_debug_info = os.path.join(new_dir, "renamed.debug") | ||
| os.rename(debug_info, renamed_debug_info) | ||
| target = self.dbg.CreateTarget(exe) | ||
| self.assertTrue(target, VALID_TARGET) | ||
| self.assertGreater(target.GetNumModules(), 0) | ||
|
|
||
| main_exe_module = target.GetModuleAtIndex(0) | ||
| eh_frame = main_exe_module.FindSection(".eh_frame") | ||
| self.assertTrue(eh_frame.IsValid()) | ||
| self.assertGreater(eh_frame.size, 0) | ||
|
|
||
| # Should be stripped in main executable. | ||
| debug_info_section = main_exe_module.FindSection(".debug_info") | ||
| self.assertFalse(debug_info_section.IsValid()) | ||
|
|
||
| ci = self.dbg.GetCommandInterpreter() | ||
| res = lldb.SBCommandReturnObject() | ||
| ci.HandleCommand(f"target symbols add {renamed_debug_info}", res) | ||
| self.assertTrue(res.Succeeded()) | ||
|
|
||
| # Should be stripped in .debuginfo but be present in main executable. | ||
| main_exe_module = target.GetModuleAtIndex(0) | ||
| eh_frame = main_exe_module.FindSection(".eh_frame") | ||
| self.assertTrue(eh_frame.IsValid()) | ||
| self.assertGreater(eh_frame.size, 0) | ||
|
|
||
| # Should be unified and both sections should have contents. | ||
| debug_info_section = main_exe_module.FindSection(".debug_info") | ||
| self.assertTrue(debug_info_section.IsValid()) | ||
| self.assertGreater(debug_info_section.file_size, 0) |
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,3 @@ | ||
| #include <stdio.h> | ||
|
|
||
| int main() { printf("Hello World\n"); } |
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.
Uh oh!
There was an error while loading. Please reload this page.