diff options
author | dim <dim@FreeBSD.org> | 2016-12-26 20:36:37 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-12-26 20:36:37 +0000 |
commit | 06210ae42d418d50d8d9365d5c9419308ae9e7ee (patch) | |
tree | ab60b4cdd6e430dda1f292a46a77ddb744723f31 /contrib/llvm/tools/lldb/source/Commands/CommandObjectSource.cpp | |
parent | 2dd166267f53df1c3748b4325d294b9b839de74b (diff) | |
download | FreeBSD-src-06210ae42d418d50d8d9365d5c9419308ae9e7ee.zip FreeBSD-src-06210ae42d418d50d8d9365d5c9419308ae9e7ee.tar.gz |
MFC r309124:
Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0
release, and add lld 3.9.0. Also completely revamp the build system for
clang, llvm, lldb and their related tools.
Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.
Release notes for llvm, clang and lld are available here:
<http://llvm.org/releases/3.9.0/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.9.0/tools/clang/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.9.0/tools/lld/docs/ReleaseNotes.html>
Thanks to Ed Maste, Bryan Drewery, Andrew Turner, Antoine Brodin and Jan
Beich for their help.
Relnotes: yes
MFC r309147:
Pull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek):
[PPC] Set SP after loading data from stack frame, if no red zone is
present
Follow-up to r280705: Make sure that the SP is only restored after
all data is loaded from the stack frame, if there is no red zone.
This completes the fix for
https://llvm.org/bugs/show_bug.cgi?id=26519.
Differential Revision: https://reviews.llvm.org/D24466
Reported by: Mark Millard
PR: 214433
MFC r309149:
Pull in r283060 from upstream llvm trunk (by Hal Finkel):
[PowerPC] Refactor soft-float support, and enable PPC64 soft float
This change enables soft-float for PowerPC64, and also makes
soft-float disable all vector instruction sets for both 32-bit and
64-bit modes. This latter part is necessary because the PPC backend
canonicalizes many Altivec vector types to floating-point types, and
so soft-float breaks scalarization support for many operations. Both
for embedded targets and for operating-system kernels desiring
soft-float support, it seems reasonable that disabling hardware
floating-point also disables vector instructions (embedded targets
without hardware floating point support are unlikely to have Altivec,
etc. and operating system kernels desiring not to use floating-point
registers to lower syscall cost are unlikely to want to use vector
registers either). If someone needs this to work, we'll need to
change the fact that we promote many Altivec operations to act on
v4f32. To make it possible to disable Altivec when soft-float is
enabled, hardware floating-point support needs to be expressed as a
positive feature, like the others, and not a negative feature,
because target features cannot have dependencies on the disabling of
some other feature. So +soft-float has now become -hard-float.
Fixes PR26970.
Pull in r283061 from upstream clang trunk (by Hal Finkel):
[PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-float
Enable soft-float support on PPC64, as the backend now supports it.
Also, the backend now uses -hard-float instead of +soft-float, so set
the target features accordingly.
Fixes PR26970.
Reported by: Mark Millard
PR: 214433
MFC r309212:
Add a few missed clang 3.9.0 files to OptionalObsoleteFiles.
MFC r309262:
Fix packaging for clang, lldb and lld 3.9.0
During the upgrade of clang/llvm etc to 3.9.0 in r309124, the PACKAGE
directive in the usr.bin/clang/*.mk files got dropped accidentally.
Restore it, with a few minor changes and additions:
* Correct license in clang.ucl to NCSA
* Add PACKAGE=clang for clang and most of the "ll" tools
* Put lldb in its own package
* Put lld in its own package
Reviewed by: gjb, jmallett
Differential Revision: https://reviews.freebsd.org/D8666
MFC r309656:
During the bootstrap phase, when building the minimal llvm library on
PowerPC, add lib/Support/Atomic.cpp. This is needed because upstream
llvm revision r271821 disabled the use of std::call_once, which causes
some fallback functions from Atomic.cpp to be used instead.
Reported by: Mark Millard
PR: 214902
MFC r309835:
Tentatively apply https://reviews.llvm.org/D18730 to work around gcc PR
70528 (bogus error: constructor required before non-static data member).
This should fix buildworld with the external gcc package.
Reported by: https://jenkins.freebsd.org/job/FreeBSD_HEAD_amd64_gcc/
MFC r310194:
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
3.9.1 release.
Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.
Release notes for llvm, clang and lld will be available here:
<http://releases.llvm.org/3.9.1/docs/ReleaseNotes.html>
<http://releases.llvm.org/3.9.1/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/3.9.1/tools/lld/docs/ReleaseNotes.html>
Relnotes: yes
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Commands/CommandObjectSource.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Commands/CommandObjectSource.cpp | 132 |
1 files changed, 59 insertions, 73 deletions
diff --git a/contrib/llvm/tools/lldb/source/Commands/CommandObjectSource.cpp b/contrib/llvm/tools/lldb/source/Commands/CommandObjectSource.cpp index a9e52d1..cef9d09 100644 --- a/contrib/llvm/tools/lldb/source/Commands/CommandObjectSource.cpp +++ b/contrib/llvm/tools/lldb/source/Commands/CommandObjectSource.cpp @@ -35,7 +35,6 @@ using namespace lldb; using namespace lldb_private; - #pragma mark CommandObjectSourceInfo //---------------------------------------------------------------------- // CommandObjectSourceInfo - debug line entries dumping command @@ -43,13 +42,12 @@ using namespace lldb_private; class CommandObjectSourceInfo : public CommandObjectParsed { - class CommandOptions : public Options { public: CommandOptions (CommandInterpreter &interpreter) : Options(interpreter) {} - ~CommandOptions () override {} + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -119,6 +117,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed { return g_option_table; } + static OptionDefinition g_option_table[]; // Instance variables to hold the values for command options. @@ -133,15 +132,16 @@ class CommandObjectSourceInfo : public CommandObjectParsed }; public: - CommandObjectSourceInfo (CommandInterpreter &interpreter) - : CommandObjectParsed(interpreter, "source info", "Display source line information (as specified) based " - "on the current executable's debug info.", - NULL, eCommandRequiresTarget), + CommandObjectSourceInfo(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "source info", "Display source line information for the current target " + "process. Defaults to instruction pointer in current stack " + "frame.", + nullptr, eCommandRequiresTarget), m_options(interpreter) { } - ~CommandObjectSourceInfo () override {} + ~CommandObjectSourceInfo() override = default; Options * GetOptions () override @@ -150,7 +150,6 @@ public: } protected: - // Dump the line entries in each symbol context. // Return the number of entries found. // If module_list is set, only dump lines contained in one of the modules. @@ -172,7 +171,7 @@ protected: if (file_spec) { assert(file_spec.GetFilename().AsCString()); - has_path = (file_spec.GetDirectory().AsCString() != 0); + has_path = (file_spec.GetDirectory().AsCString() != nullptr); } // Dump all the line entries for the file in the list. @@ -240,7 +239,7 @@ protected: if (cu) { assert(file_spec.GetFilename().AsCString()); - bool has_path = (file_spec.GetDirectory().AsCString() != 0); + bool has_path = (file_spec.GetDirectory().AsCString() != nullptr); const FileSpecList &cu_file_list = cu->GetSupportFiles(); size_t file_idx = cu_file_list.FindFileIndex(0, file_spec, has_path); if (file_idx != UINT32_MAX) @@ -390,7 +389,7 @@ protected: else { StreamString addr_strm; - so_addr.Dump(&addr_strm, NULL, Address::DumpStyleModuleWithFileAddress); + so_addr.Dump(&addr_strm, nullptr, Address::DumpStyleModuleWithFileAddress); error_strm.Printf("Address 0x%" PRIx64 " resolves to %s, but there is" " no source information available for this address.\n", addr, addr_strm.GetData()); @@ -399,7 +398,7 @@ protected: else { StreamString addr_strm; - so_addr.Dump(&addr_strm, NULL, Address::DumpStyleModuleWithFileAddress); + so_addr.Dump(&addr_strm, nullptr, Address::DumpStyleModuleWithFileAddress); error_strm.Printf("Address 0x%" PRIx64 " resolves to %s, but it cannot" " be found in any modules.\n", addr, addr_strm.GetData()); @@ -573,7 +572,7 @@ protected: DumpLinesForFrame (CommandReturnObject &result) { StackFrame *cur_frame = m_exe_ctx.GetFramePtr(); - if (cur_frame == NULL) + if (cur_frame == nullptr) { result.AppendError("No selected frame to use to find the default source."); return false; @@ -613,10 +612,10 @@ protected: } Target *target = m_exe_ctx.GetTargetPtr(); - if (target == NULL) + if (target == nullptr) { target = m_interpreter.GetDebugger().GetSelectedTarget().get(); - if (target == NULL) + if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command."); @@ -631,7 +630,7 @@ protected: // Collect the list of modules to search. m_module_list.Clear(); - if (m_options.modules.size() > 0) + if (!m_options.modules.empty()) { for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) { @@ -699,27 +698,26 @@ protected: }; OptionDefinition CommandObjectSourceInfo::CommandOptions::g_option_table[] = { - {LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, + {LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "The number of line entries to display."}, - {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, NULL, NULL, + {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source in the given module or shared library (can be " "specified more than once)."}, - {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, + {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."}, - {LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, + {LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to start the displaying lines."}, - {LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, + {LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to stop displaying lines."}, - {LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, + {LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."}, - {LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, + {LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the " "corresponding file and line."}, - {0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL} + {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr} }; - #pragma mark CommandObjectSourceList //------------------------------------------------------------------------- // CommandObjectSourceList @@ -727,7 +725,6 @@ OptionDefinition CommandObjectSourceInfo::CommandOptions::g_option_table[] = { class CommandObjectSourceList : public CommandObjectParsed { - class CommandOptions : public Options { public: @@ -736,9 +733,7 @@ class CommandObjectSourceList : public CommandObjectParsed { } - ~CommandOptions () override - { - } + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -810,6 +805,7 @@ class CommandObjectSourceList : public CommandObjectParsed { return g_option_table; } + static OptionDefinition g_option_table[]; // Instance variables to hold the values for command options. @@ -823,22 +819,17 @@ class CommandObjectSourceList : public CommandObjectParsed bool show_bp_locs; bool reverse; }; - -public: - CommandObjectSourceList(CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "source list", - "Display source code (as specified) based on the current executable's debug info.", - NULL, - eCommandRequiresTarget), - m_options (interpreter) - { - } - ~CommandObjectSourceList () override +public: + CommandObjectSourceList(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "source list", + "Display source code for the current target process as specified by options.", nullptr, + eCommandRequiresTarget), + m_options(interpreter) { } + ~CommandObjectSourceList() override = default; Options * GetOptions () override @@ -853,7 +844,7 @@ public: // values for this invocation... I have to scan the arguments directly. size_t num_args = current_command_args.GetArgumentCount(); bool is_reverse = false; - for (size_t i = 0 ; i < num_args; i++) + for (size_t i = 0; i < num_args; i++) { const char *arg = current_command_args.GetArgumentAtIndex(i); if (arg && (strcmp(arg, "-r") == 0 || strcmp(arg, "--reverse") == 0)) @@ -875,7 +866,6 @@ public: } protected: - struct SourceInfo { ConstString function; @@ -903,7 +893,7 @@ protected: operator == (const SourceInfo &rhs) const { return function == rhs.function && - line_entry.file == rhs.line_entry.file && + line_entry.original_file == rhs.line_entry.original_file && line_entry.line == rhs.line_entry.line; } @@ -911,7 +901,7 @@ protected: operator != (const SourceInfo &rhs) const { return function != rhs.function || - line_entry.file != rhs.line_entry.file || + line_entry.original_file != rhs.line_entry.original_file || line_entry.line != rhs.line_entry.line; } @@ -950,7 +940,7 @@ protected: uint32_t end_line; FileSpec end_file; - if (sc.block == NULL) + if (sc.block == nullptr) { // Not an inlined function sc.function->GetStartLineSourceInfo (start_file, start_line); @@ -1194,7 +1184,7 @@ protected: // in all modules const ModuleList &module_list = target->GetImages(); const size_t num_modules = module_list.GetSize(); - for (size_t i=0; i<num_modules; ++i) + for (size_t i = 0; i < num_modules; ++i) { ModuleSP module_sp (module_list.GetModuleAtIndex(i)); if (module_sp && module_sp->ResolveFileAddress(m_options.address, so_addr)) @@ -1231,7 +1221,7 @@ protected: } else { - so_addr.Dump(&error_strm, NULL, Address::DumpStyleModuleWithFileAddress); + so_addr.Dump(&error_strm, nullptr, Address::DumpStyleModuleWithFileAddress); result.AppendErrorWithFormat("address resolves to %s, but there is no line table information available for this address.\n", error_strm.GetData()); result.SetStatus (eReturnStatusFailed); @@ -1248,7 +1238,7 @@ protected: } } uint32_t num_matches = sc_list.GetSize(); - for (uint32_t i=0; i<num_matches; ++i) + for (uint32_t i = 0; i < num_matches; ++i) { SymbolContext sc; sc_list.GetContextAtIndex(i, sc); @@ -1339,7 +1329,6 @@ protected: { result.SetStatus (eReturnStatusSuccessFinishResult); } - } } else @@ -1350,7 +1339,7 @@ protected: SymbolContextList sc_list; size_t num_matches = 0; - if (m_options.modules.size() > 0) + if (!m_options.modules.empty()) { ModuleList matching_modules; for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) @@ -1389,7 +1378,7 @@ protected: if (num_matches > 1) { bool got_multiple = false; - FileSpec *test_cu_spec = NULL; + FileSpec *test_cu_spec = nullptr; for (unsigned i = 0; i < num_matches; i++) { @@ -1461,27 +1450,27 @@ protected: { if (m_breakpoint_locations.GetFileLineMatches().GetSize() > 0) return &m_breakpoint_locations.GetFileLineMatches(); - return NULL; + return nullptr; } + CommandOptions m_options; FileLineResolver m_breakpoint_locations; std::string m_reverse_name; - }; OptionDefinition CommandObjectSourceList::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, "The number of source lines to display."}, +{ LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "The number of source lines to display."}, { LLDB_OPT_SET_1 | - LLDB_OPT_SET_2 , false, "shlib", 's', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library."}, -{ LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."}, -{ LLDB_OPT_SET_1 , false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."}, -{ LLDB_OPT_SET_1 , false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, "The line number at which to start the display source."}, -{ LLDB_OPT_SET_2 , false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."}, -{ LLDB_OPT_SET_3 , false, "address",'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."}, -{ LLDB_OPT_SET_4, false, "reverse", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source."}, -{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } + LLDB_OPT_SET_2 , false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library."}, +{ LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."}, +{ LLDB_OPT_SET_1 , false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."}, +{ LLDB_OPT_SET_1 , false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "The line number at which to start the display source."}, +{ LLDB_OPT_SET_2 , false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."}, +{ LLDB_OPT_SET_3 , false, "address",'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."}, +{ LLDB_OPT_SET_4, false, "reverse", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source."}, +{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; #pragma mark CommandObjectMultiwordSource @@ -1489,17 +1478,14 @@ CommandObjectSourceList::CommandOptions::g_option_table[] = // CommandObjectMultiwordSource //------------------------------------------------------------------------- -CommandObjectMultiwordSource::CommandObjectMultiwordSource (CommandInterpreter &interpreter) : - CommandObjectMultiword (interpreter, - "source", - "A set of commands for accessing source file information", - "source <subcommand> [<subcommand-options>]") +CommandObjectMultiwordSource::CommandObjectMultiwordSource(CommandInterpreter &interpreter) + : CommandObjectMultiword( + interpreter, "source", + "Commands for examining source code described by debug information for the current target process.", + "source <subcommand> [<subcommand-options>]") { LoadSubCommand ("info", CommandObjectSP (new CommandObjectSourceInfo (interpreter))); LoadSubCommand ("list", CommandObjectSP (new CommandObjectSourceList (interpreter))); } -CommandObjectMultiwordSource::~CommandObjectMultiwordSource () -{ -} - +CommandObjectMultiwordSource::~CommandObjectMultiwordSource() = default; |