summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-12-26 20:36:37 +0000
committerdim <dim@FreeBSD.org>2016-12-26 20:36:37 +0000
commit06210ae42d418d50d8d9365d5c9419308ae9e7ee (patch)
treeab60b4cdd6e430dda1f292a46a77ddb744723f31 /contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
parent2dd166267f53df1c3748b4325d294b9b839de74b (diff)
downloadFreeBSD-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/CommandObjectWatchpointCommand.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpointCommand.cpp121
1 files changed, 49 insertions, 72 deletions
diff --git a/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
index 2fa849f..0ae1850 100644
--- a/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
+++ b/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -9,11 +9,12 @@
// C Includes
// C++ Includes
+#include <vector>
-
+// Other libraries and framework includes
+// Project includes
#include "CommandObjectWatchpointCommand.h"
#include "CommandObjectWatchpoint.h"
-
#include "lldb/Core/IOHandler.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -23,8 +24,6 @@
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/State.h"
-#include <vector>
-
using namespace lldb;
using namespace lldb_private;
@@ -32,20 +31,17 @@ using namespace lldb_private;
// CommandObjectWatchpointCommandAdd
//-------------------------------------------------------------------------
-
class CommandObjectWatchpointCommandAdd :
public CommandObjectParsed,
public IOHandlerDelegateMultiline
{
public:
-
- CommandObjectWatchpointCommandAdd (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "add",
- "Add a set of commands to a watchpoint, to be executed whenever the watchpoint is hit.",
- NULL),
- IOHandlerDelegateMultiline("DONE", IOHandlerDelegate::Completion::LLDBCommand),
- m_options (interpreter)
+ CommandObjectWatchpointCommandAdd(CommandInterpreter &interpreter)
+ : CommandObjectParsed(
+ interpreter, "add",
+ "Add a set of LLDB commands to a watchpoint, to be executed whenever the watchpoint is hit.", nullptr),
+ IOHandlerDelegateMultiline("DONE", IOHandlerDelegate::Completion::LLDBCommand),
+ m_options(interpreter)
{
SetHelpLong (
R"(
@@ -169,7 +165,7 @@ are no syntax errors may indicate that a function was declared but never called.
m_arguments.push_back (arg);
}
- ~CommandObjectWatchpointCommandAdd () override {}
+ ~CommandObjectWatchpointCommandAdd() override = default;
Options *
GetOptions () override
@@ -187,8 +183,7 @@ are no syntax errors may indicate that a function was declared but never called.
output_sp->Flush();
}
}
-
-
+
void
IOHandlerInputComplete (IOHandler &io_handler, std::string &line) override
{
@@ -199,7 +194,7 @@ are no syntax errors may indicate that a function was declared but never called.
if (wp_options)
{
std::unique_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
- if (data_ap.get())
+ if (data_ap)
{
data_ap->user_source.SplitIntoLines(line);
BatonSP baton_sp (new WatchpointOptions::CommandBaton (data_ap.release()));
@@ -234,8 +229,6 @@ are no syntax errors may indicate that a function was declared but never called.
BatonSP baton_sp (new WatchpointOptions::CommandBaton (data_ap.release()));
wp_options->SetCallback (WatchpointOptionsCallbackFunction, baton_sp);
-
- return;
}
static bool
@@ -244,10 +237,9 @@ are no syntax errors may indicate that a function was declared but never called.
lldb::user_id_t watch_id)
{
bool ret_value = true;
- if (baton == NULL)
+ if (baton == nullptr)
return true;
-
-
+
WatchpointOptions::CommandData *data = (WatchpointOptions::CommandData *) baton;
StringList &commands = data->user_source;
@@ -288,7 +280,6 @@ are no syntax errors may indicate that a function was declared but never called.
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_use_commands (false),
@@ -300,7 +291,7 @@ are no syntax errors may indicate that a function was declared but never called.
{
}
- ~CommandOptions () override {}
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -321,14 +312,8 @@ are no syntax errors may indicate that a function was declared but never called.
eScriptLanguageNone,
error);
- if (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault)
- {
- m_use_script_language = true;
- }
- else
- {
- m_use_script_language = false;
- }
+ m_use_script_language =
+ (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault);
break;
case 'e':
@@ -341,11 +326,9 @@ are no syntax errors may indicate that a function was declared but never called.
break;
case 'F':
- {
- m_use_one_liner = false;
- m_use_script_language = true;
- m_function_name.assign(option_arg);
- }
+ m_use_one_liner = false;
+ m_use_script_language = true;
+ m_function_name.assign(option_arg);
break;
default:
@@ -353,6 +336,7 @@ are no syntax errors may indicate that a function was declared but never called.
}
return error;
}
+
void
OptionParsingStarting () override
{
@@ -395,7 +379,7 @@ protected:
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
- if (target == NULL)
+ if (target == nullptr)
{
result.AppendError ("There is not a current executable; there are no watchpoints to which to add commands");
result.SetStatus (eReturnStatusFailed);
@@ -412,7 +396,7 @@ protected:
return false;
}
- if (m_options.m_use_script_language == false && m_options.m_function_name.size())
+ if (!m_options.m_use_script_language && !m_options.m_function_name.empty())
{
result.AppendError ("need to enable scripting to have a function run as a watchpoint command");
result.SetStatus (eReturnStatusFailed);
@@ -436,11 +420,11 @@ protected:
{
Watchpoint *wp = target->GetWatchpointList().FindByID (cur_wp_id).get();
// Sanity check wp first.
- if (wp == NULL) continue;
+ if (wp == nullptr) continue;
WatchpointOptions *wp_options = wp->GetOptions();
// Skip this watchpoint if wp_options is not good.
- if (wp_options == NULL) continue;
+ if (wp_options == nullptr) continue;
// If we are using script language, get the script interpreter
// in order to set or collect command callback. Otherwise, call
@@ -456,7 +440,7 @@ protected:
// Special handling for using a Python function by name
// instead of extending the watchpoint callback data structures, we just automatize
// what the user would do manually: make their watchpoint command be a function call
- else if (m_options.m_function_name.size())
+ else if (!m_options.m_function_name.empty())
{
std::string oneliner(m_options.m_function_name);
oneliner += "(frame, wp, internal_dict)";
@@ -489,7 +473,6 @@ private:
CommandOptions m_options;
};
-
// FIXME: "script-type" needs to have its contents determined dynamically, so somebody can add a new scripting
// language to lldb and have it pickable here without having to change this enumeration by hand and rebuild lldb proper.
@@ -499,25 +482,25 @@ g_script_option_enumeration[4] =
{ eScriptLanguageNone, "command", "Commands are in the lldb command interpreter language"},
{ eScriptLanguagePython, "python", "Commands are in the Python language."},
{ eSortOrderByName, "default-script", "Commands are in the default scripting language."},
- { 0, NULL, NULL }
+ { 0, nullptr, nullptr }
};
OptionDefinition
CommandObjectWatchpointCommandAdd::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOneLiner,
+ { LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOneLiner,
"Specify a one-line watchpoint command inline. Be sure to surround it with quotes." },
- { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
+ { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
"Specify whether watchpoint command execution should terminate on error." },
- { LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, NULL, g_script_option_enumeration, 0, eArgTypeNone,
+ { LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, nullptr, g_script_option_enumeration, 0, eArgTypeNone,
"Specify the language for the commands - if none is specified, the lldb command interpreter will be used."},
- { LLDB_OPT_SET_2, false, "python-function", 'F', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonFunction,
+ { LLDB_OPT_SET_2, false, "python-function", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonFunction,
"Give the name of a Python function to run as command for this watchpoint. Be sure to give a module name if appropriate."},
- { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+ { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -528,10 +511,10 @@ class CommandObjectWatchpointCommandDelete : public CommandObjectParsed
{
public:
CommandObjectWatchpointCommandDelete (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "delete",
- "Delete the set of commands from a watchpoint.",
- NULL)
+ CommandObjectParsed(interpreter,
+ "delete",
+ "Delete the set of commands from a watchpoint.",
+ nullptr)
{
CommandArgumentEntry arg;
CommandArgumentData wp_id_arg;
@@ -547,8 +530,7 @@ public:
m_arguments.push_back (arg);
}
-
- ~CommandObjectWatchpointCommandDelete () override {}
+ ~CommandObjectWatchpointCommandDelete() override = default;
protected:
bool
@@ -556,7 +538,7 @@ protected:
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
- if (target == NULL)
+ if (target == nullptr)
{
result.AppendError ("There is not a current executable; there are no watchpoints from which to delete commands");
result.SetStatus (eReturnStatusFailed);
@@ -619,10 +601,10 @@ class CommandObjectWatchpointCommandList : public CommandObjectParsed
{
public:
CommandObjectWatchpointCommandList (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "list",
- "List the script or set of commands to be executed when the watchpoint is hit.",
- NULL)
+ CommandObjectParsed(interpreter,
+ "list",
+ "List the script or set of commands to be executed when the watchpoint is hit.",
+ nullptr)
{
CommandArgumentEntry arg;
CommandArgumentData wp_id_arg;
@@ -638,7 +620,7 @@ public:
m_arguments.push_back (arg);
}
- ~CommandObjectWatchpointCommandList () override {}
+ ~CommandObjectWatchpointCommandList() override = default;
protected:
bool
@@ -646,7 +628,7 @@ protected:
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
- if (target == NULL)
+ if (target == nullptr)
{
result.AppendError ("There is not a current executable; there are no watchpoints for which to list commands");
result.SetStatus (eReturnStatusFailed);
@@ -725,11 +707,10 @@ protected:
// CommandObjectWatchpointCommand
//-------------------------------------------------------------------------
-CommandObjectWatchpointCommand::CommandObjectWatchpointCommand (CommandInterpreter &interpreter) :
- CommandObjectMultiword (interpreter,
- "command",
- "A set of commands for adding, removing and examining bits of code to be executed when the watchpoint is hit (watchpoint 'commmands').",
- "command <sub-command> [<sub-command-options>] <watchpoint-id>")
+CommandObjectWatchpointCommand::CommandObjectWatchpointCommand(CommandInterpreter &interpreter)
+ : CommandObjectMultiword(interpreter, "command", "Commands for adding, removing and examining LLDB commands "
+ "executed when the watchpoint is hit (watchpoint 'commmands').",
+ "command <sub-command> [<sub-command-options>] <watchpoint-id>")
{
CommandObjectSP add_command_object (new CommandObjectWatchpointCommandAdd (interpreter));
CommandObjectSP delete_command_object (new CommandObjectWatchpointCommandDelete (interpreter));
@@ -744,8 +725,4 @@ CommandObjectWatchpointCommand::CommandObjectWatchpointCommand (CommandInterpret
LoadSubCommand ("list", list_command_object);
}
-CommandObjectWatchpointCommand::~CommandObjectWatchpointCommand ()
-{
-}
-
-
+CommandObjectWatchpointCommand::~CommandObjectWatchpointCommand() = default;
OpenPOWER on IntegriCloud