-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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] Fix TestLoadUnload.py #117416
Open
splhack
wants to merge
1
commit into
llvm:main
Choose a base branch
from
splhack:fix-coredump2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[lldb] Fix TestLoadUnload.py #117416
+16
−22
Conversation
This file contains 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
ELF core debugging fix llvm#117070 broke TestLoadUnload.py tests due to GetModuleSpec call, ProcessGDBRemote fetches modules from remote. Revise the original PR, renamed FindBuildId to FindModuleUUID.
@llvm/pr-subscribers-lldb Author: Kazuki Sakamoto (splhack) ChangesELF core debugging fix #117070 broke TestLoadUnload.py tests due to GetModuleSpec call, ProcessGDBRemote fetches modules from remote. Revise the original PR, renamed FindBuildId to FindModuleUUID. Full diff: https://github.com/llvm/llvm-project/pull/117416.diff 5 Files Affected:
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index b8c53a474ba6b9..a184e6dd891aff 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1380,6 +1380,8 @@ class Process : public std::enable_shared_from_this<Process>,
virtual bool GetProcessInfo(ProcessInstanceInfo &info);
+ virtual lldb_private::UUID FindModuleUUID(const llvm::StringRef path);
+
/// Get the exit status for a process.
///
/// \return
diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp
index 3c6c6bd365706e..acc84dbf016fbe 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -157,11 +157,9 @@ DynamicLoader::GetSectionListFromModule(const ModuleSP module) const {
ModuleSP DynamicLoader::FindModuleViaTarget(const FileSpec &file) {
Target &target = m_process->GetTarget();
ModuleSpec module_spec(file, target.GetArchitecture());
- ModuleSpec module_spec_from_process;
- // Process may be able to augment the module_spec with UUID, e.g. ELF core.
- if (m_process->GetModuleSpec(file, target.GetArchitecture(),
- module_spec_from_process)) {
- module_spec = module_spec_from_process;
+ if (UUID uuid = m_process->FindModuleUUID(file.GetPath())) {
+ // Process may be able to augment the module_spec with UUID, e.g. ELF core.
+ module_spec.GetUUID() = uuid;
}
if (ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec))
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 57b12f07b5e0be..b3916cc913f7db 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -286,20 +286,12 @@ void ProcessElfCore::UpdateBuildIdForNTFileEntries() {
}
}
-bool ProcessElfCore::GetModuleSpec(const FileSpec &module_file_spec,
- const ArchSpec &arch,
- ModuleSpec &module_spec) {
- module_spec.Clear();
- for (NT_FILE_Entry &entry : m_nt_file_entries) {
- if (module_file_spec.GetPath() == entry.path) {
- module_spec.GetFileSpec() = module_file_spec;
- module_spec.GetArchitecture() = arch;
- module_spec.GetUUID() = entry.uuid;
- return true;
- }
- }
-
- return false;
+UUID ProcessElfCore::FindModuleUUID(const llvm::StringRef path) {
+ // Returns the gnu uuid from matched NT_FILE entry
+ for (NT_FILE_Entry &entry : m_nt_file_entries)
+ if (path == entry.path)
+ return entry.uuid;
+ return UUID();
}
lldb_private::DynamicLoader *ProcessElfCore::GetDynamicLoader() {
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
index a7b1822ccf01ff..a91c04a277f601 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
@@ -163,9 +163,7 @@ class ProcessElfCore : public lldb_private::PostMortemProcess {
// Populate gnu uuid for each NT_FILE entry
void UpdateBuildIdForNTFileEntries();
- bool GetModuleSpec(const lldb_private::FileSpec &module_file_spec,
- const lldb_private::ArchSpec &arch,
- lldb_private::ModuleSpec &module_spec) override;
+ lldb_private::UUID FindModuleUUID(const llvm::StringRef path) override;
// Returns the value of certain type of note of a given start address
lldb_private::UUID FindBuidIdInCoreMemory(lldb::addr_t address);
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 9125ceca74a003..db33525978a16a 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -6080,6 +6080,10 @@ bool Process::GetProcessInfo(ProcessInstanceInfo &info) {
return platform_sp->GetProcessInfo(GetID(), info);
}
+lldb_private::UUID Process::FindModuleUUID(const llvm::StringRef path) {
+ return lldb_private::UUID();
+}
+
ThreadCollectionSP Process::GetHistoryThreads(lldb::addr_t addr) {
ThreadCollectionSP threads;
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ELF core debugging fix #117070 broke TestLoadUnload.py tests due to GetModuleSpec call, ProcessGDBRemote fetches modules from remote. Revise the original PR, renamed FindBuildId to FindModuleUUID.