[Lldb-commits] [PATCH] Fix Module::GetSymbolFileFileSpec and simplify CommandObjectTargetModulesList::PrintModule
Ilia K
ki.stfu at gmail.com
Tue Mar 10 05:41:21 PDT 2015
Add SymbolVendor::GetMainFileSpec
http://reviews.llvm.org/D8002
Files:
include/lldb/Symbol/SymbolVendor.h
source/Commands/CommandObjectTarget.cpp
source/Symbol/SymbolVendor.cpp
Index: include/lldb/Symbol/SymbolVendor.h
===================================================================
--- include/lldb/Symbol/SymbolVendor.h
+++ include/lldb/Symbol/SymbolVendor.h
@@ -164,6 +164,12 @@
return m_sym_file_ap.get();
}
+ FileSpec &
+ GetMainFileSpec();
+
+ const FileSpec &
+ GetMainFileSpec() const;
+
// Get module unified section list symbol table.
virtual Symtab *
GetSymtab ();
Index: source/Commands/CommandObjectTarget.cpp
===================================================================
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -3467,28 +3467,24 @@
case 's':
case 'S':
{
- SymbolVendor *symbol_vendor = module->GetSymbolVendor();
+ const SymbolVendor *symbol_vendor = module->GetSymbolVendor();
if (symbol_vendor)
{
- SymbolFile *symbol_file = symbol_vendor->GetSymbolFile();
- if (symbol_file)
+ const FileSpec &symfile_spec = symbol_vendor->GetMainFileSpec();
+ if (format_char == 'S')
{
- if (format_char == 'S')
+ // Dump symbol file only if different from module file
+ if (!symfile_spec || symfile_spec == module->GetFileSpec())
{
- FileSpec &symfile_spec = symbol_file->GetObjectFile()->GetFileSpec();
- // Dump symbol file only if different from module file
- if (!symfile_spec || symfile_spec == module->GetFileSpec())
- {
- print_space = false;
- break;
- }
- // Add a newline and indent past the index
- strm.Printf ("\n%*s", indent, "");
+ print_space = false;
+ break;
}
- DumpFullpath (strm, &symbol_file->GetObjectFile()->GetFileSpec(), width);
- dump_object_name = true;
- break;
+ // Add a newline and indent past the index
+ strm.Printf ("\n%*s", indent, "");
}
+ DumpFullpath (strm, &symfile_spec, width);
+ dump_object_name = true;
+ break;
}
strm.Printf("%.*s", width, "<NONE>");
}
Index: source/Symbol/SymbolVendor.cpp
===================================================================
--- source/Symbol/SymbolVendor.cpp
+++ source/Symbol/SymbolVendor.cpp
@@ -437,6 +437,32 @@
return cu_sp;
}
+FileSpec &
+GetMainFileSpec()
+{
+ if (m_sym_file_ap.get())
+ {
+ ObjectFile *symfile_objfile = m_sym_file_ap->GetObjectFile();
+ if (symfile_objfile)
+ return symfile_objfile->GetFileSpec();
+ }
+
+ return FileSpec();
+}
+
+const FileSpec &
+GetMainFileSpec() const
+{
+ if (m_sym_file_ap.get())
+ {
+ const ObjectFile *symfile_objfile = m_sym_file_ap->GetObjectFile();
+ if (symfile_objfile)
+ return symfile_objfile->GetFileSpec();
+ }
+
+ return FileSpec();
+}
+
Symtab *
SymbolVendor::GetSymtab ()
{
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8002.21567.patch
Type: text/x-patch
Size: 3807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150310/1d147109/attachment.bin>
More information about the lldb-commits
mailing list