summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpoint.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/CommandObjectWatchpoint.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/CommandObjectWatchpoint.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpoint.cpp261
1 files changed, 119 insertions, 142 deletions
diff --git a/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpoint.cpp b/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpoint.cpp
index a97f5ad..977b6bb 100644
--- a/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/contrib/llvm/tools/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -12,7 +12,11 @@
// C Includes
// C++ Includes
+#include <vector>
+
// Other libraries and framework includes
+#include "llvm/ADT/StringRef.h"
+
// Project includes
#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Breakpoint/WatchpointList.h"
@@ -28,10 +32,6 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
-#include "llvm/ADT/StringRef.h"
-
-#include <vector>
-
using namespace lldb;
using namespace lldb_private;
@@ -47,7 +47,7 @@ AddWatchpointDescription(Stream *s, Watchpoint *wp, lldb::DescriptionLevel level
static bool
CheckTargetForWatchpointOperations(Target *target, CommandReturnObject &result)
{
- if (target == NULL)
+ if (target == nullptr)
{
result.AppendError ("Invalid target. No existing target or watchpoints.");
result.SetStatus (eReturnStatusFailed);
@@ -87,7 +87,7 @@ CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(Target *target, Args &args
// Pre-condition: args.GetArgumentCount() > 0.
if (args.GetArgumentCount() == 0)
{
- if (target == NULL)
+ if (target == nullptr)
return false;
WatchpointSP watch_sp = target->GetLastCreatedWatchpoint();
if (watch_sp)
@@ -166,10 +166,10 @@ class CommandObjectWatchpointList : public CommandObjectParsed
{
public:
CommandObjectWatchpointList (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "watchpoint list",
- "List all watchpoints at configurable levels of detail.",
- NULL),
+ CommandObjectParsed(interpreter,
+ "watchpoint list",
+ "List all watchpoints at configurable levels of detail.",
+ nullptr),
m_options(interpreter)
{
CommandArgumentEntry arg;
@@ -178,7 +178,7 @@ public:
m_arguments.push_back(arg);
}
- ~CommandObjectWatchpointList () override {}
+ ~CommandObjectWatchpointList() override = default;
Options *
GetOptions () override
@@ -189,14 +189,13 @@ public:
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
m_level(lldb::eDescriptionLevelBrief) // Watchpoint List defaults to brief descriptions
{
}
- ~CommandOptions () override {}
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -235,7 +234,6 @@ public:
return g_option_table;
}
-
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
@@ -250,7 +248,7 @@ protected:
DoExecute (Args& command, CommandReturnObject &result) override
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
- if (target == NULL)
+ if (target == nullptr)
{
result.AppendError ("Invalid target. No current target or watchpoints.");
result.SetStatus (eReturnStatusSuccessFinishNoResult);
@@ -267,8 +265,9 @@ protected:
}
const WatchpointList &watchpoints = target->GetWatchpointList();
- Mutex::Locker locker;
- target->GetWatchpointList().GetListMutex(locker);
+
+ std::unique_lock<std::recursive_mutex> lock;
+ target->GetWatchpointList().GetListMutex(lock);
size_t num_watchpoints = watchpoints.GetSize();
@@ -324,19 +323,20 @@ private:
// CommandObjectWatchpointList::Options
//-------------------------------------------------------------------------
#pragma mark List::CommandOptions
+
OptionDefinition
CommandObjectWatchpointList::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_1, false, "brief", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
"Give a brief description of the watchpoint (no location info)."},
- { LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_2, false, "full", 'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
"Give a full description of the watchpoint and its locations."},
- { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+ { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
"Explain everything we know about the watchpoint (for debugging debugger bugs)." },
- { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+ { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -348,10 +348,10 @@ class CommandObjectWatchpointEnable : public CommandObjectParsed
{
public:
CommandObjectWatchpointEnable (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "enable",
- "Enable the specified disabled watchpoint(s). If no watchpoints are specified, enable all of them.",
- NULL)
+ CommandObjectParsed(interpreter,
+ "enable",
+ "Enable the specified disabled watchpoint(s). If no watchpoints are specified, enable all of them.",
+ nullptr)
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -359,7 +359,7 @@ public:
m_arguments.push_back(arg);
}
- ~CommandObjectWatchpointEnable () override {}
+ ~CommandObjectWatchpointEnable() override = default;
protected:
bool
@@ -370,8 +370,8 @@ protected:
if (!CheckTargetForWatchpointOperations(target, result))
return false;
- Mutex::Locker locker;
- target->GetWatchpointList().GetListMutex(locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ target->GetWatchpointList().GetListMutex(lock);
const WatchpointList &watchpoints = target->GetWatchpointList();
@@ -413,8 +413,6 @@ protected:
return result.Succeeded();
}
-
-private:
};
//-------------------------------------------------------------------------
@@ -426,10 +424,10 @@ class CommandObjectWatchpointDisable : public CommandObjectParsed
{
public:
CommandObjectWatchpointDisable (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "watchpoint disable",
- "Disable the specified watchpoint(s) without removing it/them. If no watchpoints are specified, disable them all.",
- NULL)
+ CommandObjectParsed(interpreter,
+ "watchpoint disable",
+ "Disable the specified watchpoint(s) without removing it/them. If no watchpoints are specified, disable them all.",
+ nullptr)
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -437,8 +435,7 @@ public:
m_arguments.push_back(arg);
}
-
- ~CommandObjectWatchpointDisable () override {}
+ ~CommandObjectWatchpointDisable() override = default;
protected:
bool
@@ -448,8 +445,8 @@ protected:
if (!CheckTargetForWatchpointOperations(target, result))
return false;
- Mutex::Locker locker;
- target->GetWatchpointList().GetListMutex(locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ target->GetWatchpointList().GetListMutex(lock);
const WatchpointList &watchpoints = target->GetWatchpointList();
size_t num_watchpoints = watchpoints.GetSize();
@@ -497,7 +494,6 @@ protected:
return result.Succeeded();
}
-
};
//-------------------------------------------------------------------------
@@ -512,7 +508,7 @@ public:
CommandObjectParsed(interpreter,
"watchpoint delete",
"Delete the specified watchpoint(s). If no watchpoints are specified, delete them all.",
- NULL)
+ nullptr)
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -520,7 +516,7 @@ public:
m_arguments.push_back(arg);
}
- ~CommandObjectWatchpointDelete () override {}
+ ~CommandObjectWatchpointDelete() override = default;
protected:
bool
@@ -530,9 +526,9 @@ protected:
if (!CheckTargetForWatchpointOperations(target, result))
return false;
- Mutex::Locker locker;
- target->GetWatchpointList().GetListMutex(locker);
-
+ std::unique_lock<std::recursive_mutex> lock;
+ target->GetWatchpointList().GetListMutex(lock);
+
const WatchpointList &watchpoints = target->GetWatchpointList();
size_t num_watchpoints = watchpoints.GetSize();
@@ -579,7 +575,6 @@ protected:
return result.Succeeded();
}
-
};
//-------------------------------------------------------------------------
@@ -590,10 +585,10 @@ class CommandObjectWatchpointIgnore : public CommandObjectParsed
{
public:
CommandObjectWatchpointIgnore (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "watchpoint ignore",
- "Set ignore count on the specified watchpoint(s). If no watchpoints are specified, set them all.",
- NULL),
+ CommandObjectParsed(interpreter,
+ "watchpoint ignore",
+ "Set ignore count on the specified watchpoint(s). If no watchpoints are specified, set them all.",
+ nullptr),
m_options (interpreter)
{
CommandArgumentEntry arg;
@@ -602,7 +597,7 @@ public:
m_arguments.push_back(arg);
}
- ~CommandObjectWatchpointIgnore () override {}
+ ~CommandObjectWatchpointIgnore() override = default;
Options *
GetOptions () override
@@ -613,14 +608,13 @@ public:
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_ignore_count (0)
{
}
- ~CommandOptions () override {}
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -631,12 +625,10 @@ public:
switch (short_option)
{
case 'i':
- {
m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
if (m_ignore_count == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
- }
- break;
+ break;
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@@ -657,7 +649,6 @@ public:
return g_option_table;
}
-
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
@@ -676,9 +667,9 @@ protected:
if (!CheckTargetForWatchpointOperations(target, result))
return false;
- Mutex::Locker locker;
- target->GetWatchpointList().GetListMutex(locker);
-
+ std::unique_lock<std::recursive_mutex> lock;
+ target->GetWatchpointList().GetListMutex(lock);
+
const WatchpointList &watchpoints = target->GetWatchpointList();
size_t num_watchpoints = watchpoints.GetSize();
@@ -724,14 +715,14 @@ private:
};
#pragma mark Ignore::CommandOptions
+
OptionDefinition
CommandObjectWatchpointIgnore::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." },
- { 0, false, NULL, 0 , 0, NULL, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." },
+ { 0, false, nullptr, 0 , 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
-
//-------------------------------------------------------------------------
// CommandObjectWatchpointModify
//-------------------------------------------------------------------------
@@ -740,14 +731,13 @@ CommandObjectWatchpointIgnore::CommandOptions::g_option_table[] =
class CommandObjectWatchpointModify : public CommandObjectParsed
{
public:
-
CommandObjectWatchpointModify (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "watchpoint modify",
- "Modify the options on a watchpoint or set of watchpoints in the executable. "
- "If no watchpoint is specified, act on the last created watchpoint. "
- "Passing an empty argument clears the modification.",
- NULL),
+ CommandObjectParsed(interpreter,
+ "watchpoint modify",
+ "Modify the options on a watchpoint or set of watchpoints in the executable. "
+ "If no watchpoint is specified, act on the last created watchpoint. "
+ "Passing an empty argument clears the modification.",
+ nullptr),
m_options (interpreter)
{
CommandArgumentEntry arg;
@@ -756,7 +746,7 @@ public:
m_arguments.push_back (arg);
}
- ~CommandObjectWatchpointModify () override {}
+ ~CommandObjectWatchpointModify() override = default;
Options *
GetOptions () override
@@ -767,7 +757,6 @@ public:
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_condition (),
@@ -775,7 +764,7 @@ public:
{
}
- ~CommandOptions () override {}
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -786,7 +775,7 @@ public:
switch (short_option)
{
case 'c':
- if (option_arg != NULL)
+ if (option_arg != nullptr)
m_condition.assign (option_arg);
else
m_condition.clear();
@@ -831,9 +820,9 @@ protected:
if (!CheckTargetForWatchpointOperations(target, result))
return false;
- Mutex::Locker locker;
- target->GetWatchpointList().GetListMutex(locker);
-
+ std::unique_lock<std::recursive_mutex> lock;
+ target->GetWatchpointList().GetListMutex(lock);
+
const WatchpointList &watchpoints = target->GetWatchpointList();
size_t num_watchpoints = watchpoints.GetSize();
@@ -885,11 +874,12 @@ private:
};
#pragma mark Modify::CommandOptions
+
OptionDefinition
CommandObjectWatchpointModify::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true."},
-{ 0, false, NULL, 0 , 0, NULL, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_ALL, false, "condition", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true."},
+{ 0, false, nullptr, 0 , 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -900,24 +890,23 @@ CommandObjectWatchpointModify::CommandOptions::g_option_table[] =
class CommandObjectWatchpointSetVariable : public CommandObjectParsed
{
public:
-
CommandObjectWatchpointSetVariable (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "watchpoint set variable",
- "Set a watchpoint on a variable. "
- "Use the '-w' option to specify the type of watchpoint and "
- "the '-x' option to specify the byte size to watch for. "
- "If no '-w' option is specified, it defaults to write. "
- "If no '-x' option is specified, it defaults to the variable's "
- "byte size. "
- "Note that there are limited hardware resources for watchpoints. "
- "If watchpoint setting fails, consider disable/delete existing ones "
- "to free up resources.",
- NULL,
- eCommandRequiresFrame |
- eCommandTryTargetAPILock |
- eCommandProcessMustBeLaunched |
- eCommandProcessMustBePaused ),
+ CommandObjectParsed(interpreter,
+ "watchpoint set variable",
+ "Set a watchpoint on a variable. "
+ "Use the '-w' option to specify the type of watchpoint and "
+ "the '-s' option to specify the byte size to watch for. "
+ "If no '-w' option is specified, it defaults to write. "
+ "If no '-s' option is specified, it defaults to the variable's "
+ "byte size. "
+ "Note that there are limited hardware resources for watchpoints. "
+ "If watchpoint setting fails, consider disable/delete existing ones "
+ "to free up resources.",
+ nullptr,
+ eCommandRequiresFrame |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_option_watchpoint ()
{
@@ -944,12 +933,12 @@ corresponding to the byte size of the data type."
// Push the data for the only argument into the m_arguments vector.
m_arguments.push_back (arg);
- // Absorb the '-w' and '-x' options into our option group.
+ // Absorb the '-w' and '-s' options into our option group.
m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
- ~CommandObjectWatchpointSetVariable () override {}
+ ~CommandObjectWatchpointSetVariable() override = default;
Options *
GetOptions () override
@@ -1055,7 +1044,7 @@ protected:
}
else
{
- const char *error_cstr = error.AsCString(NULL);
+ const char *error_cstr = error.AsCString(nullptr);
if (error_cstr)
result.GetErrorStream().Printf("error: %s\n", error_cstr);
else
@@ -1089,7 +1078,7 @@ protected:
{
result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRIu64 ", variable expression='%s').\n",
addr, (uint64_t)size, command.GetArgumentAtIndex(0));
- if (error.AsCString(NULL))
+ if (error.AsCString(nullptr))
result.AppendError(error.AsCString());
result.SetStatus(eReturnStatusFailed);
}
@@ -1110,24 +1099,23 @@ private:
class CommandObjectWatchpointSetExpression : public CommandObjectRaw
{
public:
-
CommandObjectWatchpointSetExpression (CommandInterpreter &interpreter) :
- CommandObjectRaw (interpreter,
- "watchpoint set expression",
- "Set a watchpoint on an address by supplying an expression. "
- "Use the '-w' option to specify the type of watchpoint and "
- "the '-x' option to specify the byte size to watch for. "
- "If no '-w' option is specified, it defaults to write. "
- "If no '-x' option is specified, it defaults to the target's "
- "pointer byte size. "
- "Note that there are limited hardware resources for watchpoints. "
- "If watchpoint setting fails, consider disable/delete existing ones "
- "to free up resources.",
- NULL,
- eCommandRequiresFrame |
- eCommandTryTargetAPILock |
- eCommandProcessMustBeLaunched |
- eCommandProcessMustBePaused ),
+ CommandObjectRaw(interpreter,
+ "watchpoint set expression",
+ "Set a watchpoint on an address by supplying an expression. "
+ "Use the '-w' option to specify the type of watchpoint and "
+ "the '-s' option to specify the byte size to watch for. "
+ "If no '-w' option is specified, it defaults to write. "
+ "If no '-s' option is specified, it defaults to the target's "
+ "pointer byte size. "
+ "Note that there are limited hardware resources for watchpoints. "
+ "If watchpoint setting fails, consider disable/delete existing ones "
+ "to free up resources.",
+ nullptr,
+ eCommandRequiresFrame |
+ eCommandTryTargetAPILock |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_option_watchpoint ()
{
@@ -1135,7 +1123,7 @@ public:
R"(
Examples:
-(lldb) watchpoint set expression -w write -x 1 -- foo + 32
+(lldb) watchpoint set expression -w write -s 1 -- foo + 32
Watches write access for the 1-byte region pointed to by the address 'foo + 32')"
);
@@ -1153,13 +1141,12 @@ Examples:
// Push the data for the only argument into the m_arguments vector.
m_arguments.push_back (arg);
- // Absorb the '-w' and '-x' options into our option group.
+ // Absorb the '-w' and '-s' options into our option group.
m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
-
- ~CommandObjectWatchpointSetExpression () override {}
+ ~CommandObjectWatchpointSetExpression() override = default;
// Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
bool
@@ -1181,11 +1168,11 @@ protected:
StackFrame *frame = m_exe_ctx.GetFramePtr();
Args command(raw_command);
- const char *expr = NULL;
+ const char *expr = nullptr;
if (raw_command[0] == '-')
{
// We have some options and these options MUST end with --.
- const char *end_options = NULL;
+ const char *end_options = nullptr;
const char *s = raw_command;
while (s && s[0])
{
@@ -1220,7 +1207,7 @@ protected:
}
}
- if (expr == NULL)
+ if (expr == nullptr)
expr = raw_command;
// If no argument is present, issue an error message. There's no way to set a watchpoint.
@@ -1300,7 +1287,7 @@ protected:
{
result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRIu64 ").\n",
addr, (uint64_t)size);
- if (error.AsCString(NULL))
+ if (error.AsCString(nullptr))
result.AppendError(error.AsCString());
result.SetStatus(eReturnStatusFailed);
}
@@ -1321,21 +1308,16 @@ private:
class CommandObjectWatchpointSet : public CommandObjectMultiword
{
public:
-
- CommandObjectWatchpointSet (CommandInterpreter &interpreter) :
- CommandObjectMultiword (interpreter,
- "watchpoint set",
- "A set of commands for setting a watchpoint.",
- "watchpoint set <subcommand> [<subcommand-options>]")
+ CommandObjectWatchpointSet(CommandInterpreter &interpreter)
+ : CommandObjectMultiword(interpreter, "watchpoint set", "Commands for setting a watchpoint.",
+ "watchpoint set <subcommand> [<subcommand-options>]")
{
LoadSubCommand ("variable", CommandObjectSP (new CommandObjectWatchpointSetVariable (interpreter)));
LoadSubCommand ("expression", CommandObjectSP (new CommandObjectWatchpointSetExpression (interpreter)));
}
-
- ~CommandObjectWatchpointSet () override {}
-
+ ~CommandObjectWatchpointSet() override = default;
};
//-------------------------------------------------------------------------
@@ -1343,11 +1325,9 @@ public:
//-------------------------------------------------------------------------
#pragma mark MultiwordWatchpoint
-CommandObjectMultiwordWatchpoint::CommandObjectMultiwordWatchpoint(CommandInterpreter &interpreter) :
- CommandObjectMultiword (interpreter,
- "watchpoint",
- "A set of commands for operating on watchpoints.",
- "watchpoint <command> [<command-options>]")
+CommandObjectMultiwordWatchpoint::CommandObjectMultiwordWatchpoint(CommandInterpreter &interpreter)
+ : CommandObjectMultiword(interpreter, "watchpoint", "Commands for operating on watchpoints.",
+ "watchpoint <subcommand> [<command-options>]")
{
CommandObjectSP list_command_object (new CommandObjectWatchpointList (interpreter));
CommandObjectSP enable_command_object (new CommandObjectWatchpointEnable (interpreter));
@@ -1377,7 +1357,4 @@ CommandObjectMultiwordWatchpoint::CommandObjectMultiwordWatchpoint(CommandInterp
LoadSubCommand ("set", set_command_object);
}
-CommandObjectMultiwordWatchpoint::~CommandObjectMultiwordWatchpoint()
-{
-}
-
+CommandObjectMultiwordWatchpoint::~CommandObjectMultiwordWatchpoint() = default;
OpenPOWER on IntegriCloud