clayborg added a comment.

Just one question if we should still try all of your new code if we have a full 
path to a DW_AT_comp_dir, but we don't find the .dwo file, should be allow your 
code to run and still try to just append the relative "dwo_name" (without comp 
dir) to each of the search paths?



================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1755
+      dwo_file.AppendPathComponent(dwo_name);
+      found = FileSystem::Instance().Exists(dwo_file);
+    } else {
----------------
If "found == false" here, do we want to fall through to the "else" clause 
below? This would mean we have a full path to a DW_AT_comp_dir, but we didn't 
find the .dwo file and "dwo_name" is relative, so maybe we should try to use 
the relative "dwo_name" below without the comp dir if not found?


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1770-1771
+      // Or it's relative to one of the user specified debug directories.
+      const FileSpecList &debug_file_search_paths =
+          Target::GetDefaultDebugFileSearchPaths();
+      size_t num_directories = debug_file_search_paths.GetSize();
----------------
On major issue we have here is if someone creates a target first, then sets the 
debug file search paths, then this will always fail because 
Target::GetDefaultDebugFileSearchPaths() gets the global target settings. This 
is because before we have a target, if any target settings get set, they get 
set in this global target settings object. Then each time you create a target, 
it will get a copy of these global settings. So this would work:
```
(lldb) settings set target.debug-file-search-paths /my/objfiles
# Global target settings are set above
(lldb) target create a.out
(lldb) run
...
```

This wouldn't:
```
(lldb) target create a.out
(lldb) settings set target.debug-file-search-paths /my/objfiles
# Current target settings are set above, not the global settings
(lldb) run
...
```
Because the global settings have nothing for the 
"target.debug-file-search-paths", but the current lldb_private::Target that was 
created by "target create a.out" does have it set, but that isn't what we are 
getting here.

We don't have access to the current target anywhere in lldb_private::Module and 
its lldb_private::ObjectFile or lldb_private::SymbolFile because 
lldb_private::Module can be used in multiple targets, so the module doesn't 
know what target it is in. This isn't something that needs to be solved here, 
but we should understand the limitations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157609/new/

https://reviews.llvm.org/D157609

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to