diff options
author | Pavel Labath <pavel@labath.sk> | 2019-08-02 08:16:35 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-08-02 08:16:35 +0000 |
commit | 23f70e83594f650830764cca446fdfcba7368460 (patch) | |
tree | 59d0f7142156dceb4cb4af1d2fe8d9a18fedf8ab /lldb/source/Commands/CommandObjectTarget.cpp | |
parent | 9eedbc4f266d1e49d335d48c4c0f717401d927d2 (diff) | |
download | bcm5719-llvm-23f70e83594f650830764cca446fdfcba7368460.tar.gz bcm5719-llvm-23f70e83594f650830764cca446fdfcba7368460.zip |
SymbolVendor: Introduce Module::GetSymbolFile
Summary:
This is the next step in avoiding funneling all SymbolFile calls through
the SymbolVendor. Right now, it is just a convenience function, but it
allows us to update all calls to SymbolVendor functions to access the
SymbolFile directly. Once all call sites have been updated, we can
remove the GetSymbolVendor member function.
This patch just updates the calls to GetSymbolVendor, which were calling
it just so they could fetch the underlying symbol file. Other calls will
be done in follow-ups.
Reviewers: JDevlieghere, clayborg, jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D65435
llvm-svn: 367664
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 94 |
1 files changed, 45 insertions, 49 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 9569632f458..1c75966552a 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2259,8 +2259,8 @@ protected: if (m_interpreter.WasInterrupted()) break; Module *m = target->GetImages().GetModulePointerAtIndex(image_idx); - SymbolFile *sf = m->GetSymbolVendor()->GetSymbolFile(); - sf->DumpClangAST(result.GetOutputStream()); + if (SymbolFile *sf = m->GetSymbolFile()) + sf->DumpClangAST(result.GetOutputStream()); } result.SetStatus(eReturnStatusSuccessFinishResult); return true; @@ -2285,8 +2285,8 @@ protected: if (m_interpreter.WasInterrupted()) break; Module *m = module_list.GetModulePointerAtIndex(i); - SymbolFile *sf = m->GetSymbolVendor()->GetSymbolFile(); - sf->DumpClangAST(result.GetOutputStream()); + if (SymbolFile *sf = m->GetSymbolFile()) + sf->DumpClangAST(result.GetOutputStream()); } } result.SetStatus(eReturnStatusSuccessFinishResult); @@ -3272,9 +3272,9 @@ protected: case 's': case 'S': { - const SymbolVendor *symbol_vendor = module->GetSymbolVendor(); - if (symbol_vendor) { - const FileSpec symfile_spec = symbol_vendor->GetMainFileSpec(); + if (const SymbolFile *symbol_file = module->GetSymbolFile()) { + const FileSpec symfile_spec = + symbol_file->GetObjectFile()->GetFileSpec(); if (format_char == 'S') { // Dump symbol file only if different from module file if (!symfile_spec || symfile_spec == module->GetFileSpec()) { @@ -4207,48 +4207,44 @@ protected: // decides to create it! module_sp->SetSymbolFileFileSpec(symbol_fspec); - SymbolVendor *symbol_vendor = - module_sp->GetSymbolVendor(true, &result.GetErrorStream()); - if (symbol_vendor) { - SymbolFile *symbol_file = symbol_vendor->GetSymbolFile(); - - if (symbol_file) { - ObjectFile *object_file = symbol_file->GetObjectFile(); - - if (object_file && object_file->GetFileSpec() == symbol_fspec) { - // Provide feedback that the symfile has been successfully added. - const FileSpec &module_fs = module_sp->GetFileSpec(); - result.AppendMessageWithFormat( - "symbol file '%s' has been added to '%s'\n", symfile_path, - module_fs.GetPath().c_str()); - - // Let clients know something changed in the module if it is - // currently loaded - ModuleList module_list; - module_list.Append(module_sp); - target->SymbolsDidLoad(module_list); - - // Make sure we load any scripting resources that may be embedded - // in the debug info files in case the platform supports that. - Status error; - StreamString feedback_stream; - module_sp->LoadScriptingResourceInTarget(target, error, - &feedback_stream); - if (error.Fail() && error.AsCString()) - result.AppendWarningWithFormat( - "unable to load scripting data for module %s - error " - "reported was %s", - module_sp->GetFileSpec() - .GetFileNameStrippingExtension() - .GetCString(), - error.AsCString()); - else if (feedback_stream.GetSize()) - result.AppendWarningWithFormat("%s", feedback_stream.GetData()); - - flush = true; - result.SetStatus(eReturnStatusSuccessFinishResult); - return true; - } + SymbolFile *symbol_file = + module_sp->GetSymbolFile(true, &result.GetErrorStream()); + if (symbol_file) { + ObjectFile *object_file = symbol_file->GetObjectFile(); + + if (object_file && object_file->GetFileSpec() == symbol_fspec) { + // Provide feedback that the symfile has been successfully added. + const FileSpec &module_fs = module_sp->GetFileSpec(); + result.AppendMessageWithFormat( + "symbol file '%s' has been added to '%s'\n", symfile_path, + module_fs.GetPath().c_str()); + + // Let clients know something changed in the module if it is + // currently loaded + ModuleList module_list; + module_list.Append(module_sp); + target->SymbolsDidLoad(module_list); + + // Make sure we load any scripting resources that may be embedded + // in the debug info files in case the platform supports that. + Status error; + StreamString feedback_stream; + module_sp->LoadScriptingResourceInTarget(target, error, + &feedback_stream); + if (error.Fail() && error.AsCString()) + result.AppendWarningWithFormat( + "unable to load scripting data for module %s - error " + "reported was %s", + module_sp->GetFileSpec() + .GetFileNameStrippingExtension() + .GetCString(), + error.AsCString()); + else if (feedback_stream.GetSize()) + result.AppendWarningWithFormat("%s", feedback_stream.GetData()); + + flush = true; + result.SetStatus(eReturnStatusSuccessFinishResult); + return true; } } // Clear the symbol file spec if anything went wrong |