summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-09-09 23:25:26 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-09-09 23:25:26 +0000
commitb1d7529e570545a8faceae1c7bf82ed4384e902e (patch)
tree76dd35da3323404ef5cd7067c145965fd8d7edaf
parent56247076847790933b5e91639f466c8c7f11ea4a (diff)
downloadbcm5719-llvm-b1d7529e570545a8faceae1c7bf82ed4384e902e.tar.gz
bcm5719-llvm-b1d7529e570545a8faceae1c7bf82ed4384e902e.zip
Add OptionGroupWatchpoint.cpp/.h (preparatory work) for hooking up watchpoint to the 'frame variable' comand.
To watch a variable for read/write, issue: frame variable -w read_write Note that '-w' option is not working yet. :-) llvm-svn: 139434
-rw-r--r--lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h63
-rw-r--r--lldb/include/lldb/lldb-enumerations.h1
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj6
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp9
-rw-r--r--lldb/source/Interpreter/CommandObject.cpp3
-rw-r--r--lldb/source/Interpreter/OptionGroupWatchpoint.cpp90
6 files changed, 170 insertions, 2 deletions
diff --git a/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h b/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
new file mode 100644
index 00000000000..dc94e1cd01d
--- /dev/null
+++ b/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
@@ -0,0 +1,63 @@
+//===-- OptionGroupWatchpoint.h ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupWatchpoint_h_
+#define liblldb_OptionGroupWatchpoint_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+
+//-------------------------------------------------------------------------
+// OptionGroupWatchpoint
+//-------------------------------------------------------------------------
+
+ class OptionGroupWatchpoint : public OptionGroup
+ {
+ public:
+
+ OptionGroupWatchpoint ();
+
+ virtual
+ ~OptionGroupWatchpoint ();
+
+ virtual uint32_t
+ GetNumDefinitions ();
+
+ virtual const OptionDefinition*
+ GetDefinitions ();
+
+ virtual Error
+ SetOptionValue (CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg);
+
+ virtual void
+ OptionParsingStarting (CommandInterpreter &interpreter);
+
+ typedef enum WatchMode {
+ eWatchRead,
+ eWatchWrite,
+ eWatchReadWrite
+ } WatchMode;
+
+ bool watch_variable;
+ WatchMode watch_mode;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OptionGroupWatchpoint);
+ };
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupWatchpoint_h_
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 704df80edf3..99522c9965a 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -408,6 +408,7 @@ namespace lldb {
eArgTypeWidth,
eArgTypeNone,
eArgTypePlatform,
+ eArgTypeWatchMode,
eArgTypeLastArg // Always keep this entry as the last entry in this enumeration!!
} CommandArgumentType;
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index cb372727341..709cb352672 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -437,6 +437,7 @@
9AC70390117675270086C050 /* SBInstructionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC7038F117675270086C050 /* SBInstructionList.h */; settings = {ATTRIBUTES = (Public, ); }; };
9AC703AF117675410086C050 /* SBInstruction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC703AE117675410086C050 /* SBInstruction.cpp */; };
9AC703B1117675490086C050 /* SBInstructionList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC703B0117675490086C050 /* SBInstructionList.cpp */; };
+ B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */; };
B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */; };
B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointLocationList.cpp */; };
B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */; };
@@ -1295,6 +1296,8 @@
AF68D3301255A110002FF25B /* UnwindLLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindLLDB.h; path = Utility/UnwindLLDB.h; sourceTree = "<group>"; };
AF94005711C03F6500085DB9 /* SymbolVendor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolVendor.cpp; path = source/Symbol/SymbolVendor.cpp; sourceTree = "<group>"; };
B23DD24F12EDFAC1000C3894 /* ARMUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMUtils.h; path = Utility/ARMUtils.h; sourceTree = "<group>"; };
+ B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupWatchpoint.cpp; path = source/Interpreter/OptionGroupWatchpoint.cpp; sourceTree = "<group>"; };
+ B2462248141AD39B00F3D409 /* OptionGroupWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupWatchpoint.h; path = include/lldb/Interpreter/OptionGroupWatchpoint.h; sourceTree = "<group>"; };
B27318411416AC12006039C8 /* WatchpointLocationList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointLocationList.cpp; path = source/Breakpoint/WatchpointLocationList.cpp; sourceTree = "<group>"; };
B27318431416AC43006039C8 /* WatchpointLocationList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WatchpointLocationList.h; path = include/lldb/Breakpoint/WatchpointLocationList.h; sourceTree = "<group>"; };
B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InferiorCallPOSIX.cpp; path = Utility/InferiorCallPOSIX.cpp; sourceTree = "<group>"; };
@@ -2351,7 +2354,9 @@
267C0128136880C7006E963E /* OptionGroupValueObjectDisplay.h */,
267C012A136880DF006E963E /* OptionGroupValueObjectDisplay.cpp */,
26ED3D6F13C5638A0017D45E /* OptionGroupVariable.h */,
+ B2462248141AD39B00F3D409 /* OptionGroupWatchpoint.h */,
26ED3D6C13C563810017D45E /* OptionGroupVariable.cpp */,
+ B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */,
26BC7DE510F1B7F900F91463 /* ScriptInterpreter.h */,
9A82010B10FFB49800182560 /* ScriptInterpreter.cpp */,
9A2771FB1135A35C00E6ADB6 /* ScriptInterpreterNone.h */,
@@ -3358,6 +3363,7 @@
26A0DA4E140F7226006DA411 /* HashedNameToDIE.cpp in Sources */,
B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */,
26E152261419CAD4007967D0 /* ObjectFilePECOFF.cpp in Sources */,
+ B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index ed27b384f89..1247209d8cd 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -28,6 +28,7 @@
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
#include "lldb/Interpreter/OptionGroupVariable.h"
+#include "lldb/Interpreter/OptionGroupWatchpoint.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -315,11 +316,15 @@ public:
"If any arguments are specified, they can be names of "
"argument, local, file static and file global variables. "
"Children of aggregate variables can be specified such as "
- "'var->child.x'.",
+ "'var->child.x'. "
+ "NOTE that '-w' option is not working yet!!! "
+ "You can choose to watch a variable with the '-w' option. "
+ "Note that hardware resources for watching are often limited.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
m_option_group (interpreter),
m_option_variable(true), // Include the frame specific options by passing "true"
+ m_option_watchpoint(),
m_varobj_options()
{
CommandArgumentEntry arg;
@@ -336,6 +341,7 @@ public:
m_arguments.push_back (arg);
m_option_group.Append (&m_option_variable, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
@@ -601,6 +607,7 @@ protected:
OptionGroupOptions m_option_group;
OptionGroupVariable m_option_variable;
+ OptionGroupWatchpoint m_option_watchpoint;
OptionGroupValueObjectDisplay m_varobj_options;
};
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index b1eafd5e30f..c3547e23995 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -829,7 +829,8 @@ CommandObject::g_arguments_data[] =
{ eArgTypeValue, "value", CommandCompletions::eNoCompletion, { NULL, false }, "A value could be anything, depending on where and how it is used." },
{ eArgTypeWidth, "width", CommandCompletions::eNoCompletion, { NULL, false }, "Help text goes here." },
{ eArgTypeNone, "none", CommandCompletions::eNoCompletion, { NULL, false }, "No help available for this." },
- { eArgTypePlatform, "platform-name", CommandCompletions::ePlatformPluginCompletion, { NULL, false }, "The name of an installed platform plug-in . Type 'platform list' to see a complete list of installed platforms." }
+ { eArgTypePlatform, "platform-name", CommandCompletions::ePlatformPluginCompletion, { NULL, false }, "The name of an installed platform plug-in . Type 'platform list' to see a complete list of installed platforms." },
+ { eArgTypeWatchMode, "watch-mode", CommandCompletions::eNoCompletion, { NULL, false }, "Specify the mode for a watchpoint." }
};
const CommandObject::ArgumentTableEntry*
diff --git a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp
new file mode 100644
index 00000000000..6d1fcb75e5b
--- /dev/null
+++ b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp
@@ -0,0 +1,90 @@
+//===-- OptionGroupWatchpoint.cpp -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Interpreter/OptionGroupWatchpoint.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-enumerations.h"
+#include "lldb/Interpreter/Args.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static OptionEnumValueElement g_watch_mode[] =
+{
+ { OptionGroupWatchpoint::eWatchRead, "read", "Watch for read"},
+ { OptionGroupWatchpoint::eWatchWrite, "write", "Watch for write"},
+ { OptionGroupWatchpoint::eWatchReadWrite, "read_write", "Watch for read/write"},
+ { 0, NULL, NULL }
+};
+
+// if you add any options here, remember to update the counters in OptionGroupWatchpoint::GetNumDefinitions()
+static OptionDefinition
+g_option_table[] =
+{
+ { LLDB_OPT_SET_1, false, "watch", 'w', required_argument, g_watch_mode, 0, eArgTypeWatchMode, "Determine how to watch a memory location (read, write, or read/write)."}
+};
+
+
+OptionGroupWatchpoint::OptionGroupWatchpoint () :
+ OptionGroup()
+{
+}
+
+OptionGroupWatchpoint::~OptionGroupWatchpoint ()
+{
+}
+
+Error
+OptionGroupWatchpoint::SetOptionValue (CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg)
+{
+ Error error;
+ char short_option = (char) g_option_table[option_idx].short_option;
+ switch (short_option)
+ {
+ case 'w': {
+ watch_variable = false;
+ OptionEnumValueElement *enum_values = g_option_table[option_idx].enum_values;
+ watch_mode = (WatchMode) Args::StringToOptionEnum(option_arg, enum_values, 0, &watch_variable);
+ break;
+ }
+ default:
+ error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option);
+ break;
+ }
+
+ return error;
+}
+
+void
+OptionGroupWatchpoint::OptionParsingStarting (CommandInterpreter &interpreter)
+{
+ watch_variable = false;
+ watch_mode = eWatchRead;
+}
+
+
+const OptionDefinition*
+OptionGroupWatchpoint::GetDefinitions ()
+{
+ return g_option_table;
+}
+
+uint32_t
+OptionGroupWatchpoint::GetNumDefinitions ()
+{
+ return 1;
+}
+
+
OpenPOWER on IntegriCloud