[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)

via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 21 15:43:05 PDT 2024


================
@@ -44,6 +44,25 @@ llvm::StringRef SymbolVendorELF::GetPluginDescriptionStatic() {
          "executables.";
 }
 
+// If this is needed elsewhere, it can be exported/moved.
+static bool IsDwpSymbolFile(const lldb::ModuleSP &module_sp,
+                            const FileSpec &file_spec) {
+  DataBufferSP dwp_file_data_sp;
+  lldb::offset_t dwp_file_data_offset = 0;
+  // Try to create an ObjectFile from the file_spec.
+  ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin(
+      module_sp, &file_spec, 0, FileSystem::Instance().GetByteSize(file_spec),
+      dwp_file_data_sp, dwp_file_data_offset);
+  if (!ObjectFileELF::classof(dwp_obj_file.get()))
----------------
GeorgeHuyubo wrote:

You probably want to do 
`if (!dwp_obj_file && !ObjectFileELF::classof(dwp_obj_file.get()))`
dwp_obj_file might be a null pointer

https://github.com/llvm/llvm-project/pull/85693


More information about the lldb-commits mailing list