-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Bug fix in FindModuleUUID #137075
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
Bug fix in FindModuleUUID #137075
Conversation
@llvm/pr-subscribers-lldb Author: None (GeorgeHuyubo) ChangesIn some core file, we are seeing that it's not always the case that the ELF header would exist in the first region in NT_FILES section. Therefore the FindModuleUUID is not able to find the module UUID by just returning the first entry with path matching. This fix change the behavior to continue search the NT_FILE entries until finding a valid UUID with path matching. Full diff: https://github.com/llvm/llvm-project/pull/137075.diff 1 Files Affected:
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 5f85f99ce7bdd..6635b15b669f1 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -289,7 +289,7 @@ void ProcessElfCore::UpdateBuildIdForNTFileEntries() {
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)
+ if (path == entry.path && entry.uuid.IsValid())
return entry.uuid;
return UUID();
}
|
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.
LGTM. Any chance you could artifically craft such a core file for a test?
I think this file historically lack a good way of testing changes due to difficulties in hand craft a ELF core file using YAML. |
The ELF support yaml2obj doesn't allow content to be supplied for a program header. It expects section headers to contain data and ELF core files don't have section headers. So it would take some modifications to the ELF obj2yaml and yaml2obj to support this. It would be great if we can add this support at some point if anyone has expertise in the yaml layer as it would be easy to create a core file, reduce it using a different tool, and then obj2yaml it for a test. |
In some core file, we are seeing that it's not always the case that the ELF header would exist in the first region in NT_FILES section. Therefore the FindModuleUUID is not able to find the module UUID by just returning the first entry with path matching. This fix change the behavior to continue search the NT_FILE entries until finding a valid UUID with path matching. Co-authored-by: George Hu <[email protected]>
In some core file, we are seeing that it's not always the case that the ELF header would exist in the first region in NT_FILES section. Therefore the FindModuleUUID is not able to find the module UUID by just returning the first entry with path matching. This fix change the behavior to continue search the NT_FILE entries until finding a valid UUID with path matching. Co-authored-by: George Hu <[email protected]>
In some core file, we are seeing that it's not always the case that the ELF header would exist in the first region in NT_FILES section. Therefore the FindModuleUUID is not able to find the module UUID by just returning the first entry with path matching. This fix change the behavior to continue search the NT_FILE entries until finding a valid UUID with path matching. Co-authored-by: George Hu <[email protected]>
In some core file, we are seeing that it's not always the case that the ELF header would exist in the first region in NT_FILES section. Therefore the FindModuleUUID is not able to find the module UUID by just returning the first entry with path matching. This fix change the behavior to continue search the NT_FILE entries until finding a valid UUID with path matching. Co-authored-by: George Hu <[email protected]>
In some core file, we are seeing that it's not always the case that the ELF header would exist in the first region in NT_FILES section. Therefore the FindModuleUUID is not able to find the module UUID by just returning the first entry with path matching.
This fix change the behavior to continue search the NT_FILE entries until finding a valid UUID with path matching.