[Lldb-commits] [lldb] [lldb]Make `list` command work with headers when possible. (PR #139002)

Vy Nguyen via lldb-commits lldb-commits at lists.llvm.org
Thu May 8 10:31:00 PDT 2025


================
@@ -1170,8 +1171,37 @@ class CommandObjectSourceList : public CommandObjectParsed {
           if (m_options.num_lines == 0)
             m_options.num_lines = 10;
           const uint32_t column = 0;
+
+          // Headers aren't always in the DWARF but if they have
+          // executable code (eg., inlined-functions) then the callsite's file(s)
+          // will be found.
+          // So if a header was requested and we got a primary file, then look
+          // thru its support file(s) for the header.
+          lldb::SupportFileSP actual_file_sp =
+              sc.comp_unit->GetPrimarySupportFile();
+          if (llvm::StringRef(m_options.file_name).ends_with(".h")) {
----------------
oontvoo wrote:

done!

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


More information about the lldb-commits mailing list