aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectWatchpoint.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-09-14 17:20:18 +0000
committerSean Callanan <scallanan@apple.com>2012-09-14 17:20:18 +0000
commit903259fea2733ba00f5c139cfafe16305a70dfb3 (patch)
tree8f0d7f2087813f24268b5d42c4979d3a345bbc9a /lldb/source/Commands/CommandObjectWatchpoint.cpp
parent3e9e081d35a1c4bfc163ca94b93b46567eb04ef7 (diff)
downloadllvm-903259fea2733ba00f5c139cfafe16305a70dfb3.zip
llvm-903259fea2733ba00f5c139cfafe16305a70dfb3.tar.gz
llvm-903259fea2733ba00f5c139cfafe16305a70dfb3.tar.bz2
Extended the "watchpoint set variable" code to
support watchpoints on globals. <rdar://problem/12297238> llvm-svn: 163913
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index d6ff811..8a74471 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -970,6 +970,21 @@ public:
}
protected:
+ static uint32_t GetVariableCallback (void *baton,
+ const char *name,
+ VariableList &variable_list)
+ {
+ Target *target = static_cast<Target *>(baton);
+ if (target)
+ {
+ return target->GetImages().FindGlobalVariables (ConstString(name),
+ true,
+ UINT32_MAX,
+ variable_list);
+ }
+ return 0;
+ }
+
virtual bool
DoExecute (Args& command,
CommandReturnObject &result)
@@ -1023,6 +1038,24 @@ protected:
expr_path_options,
var_sp,
error);
+
+ if (!valobj_sp) {
+ // Not in the frame; let's check the globals.
+
+ VariableList variable_list;
+ ValueObjectList valobj_list;
+
+ Error error (Variable::GetValuesForVariableExpressionPath (command.GetArgumentAtIndex(0),
+ exe_ctx.GetBestExecutionContextScope(),
+ GetVariableCallback,
+ target,
+ variable_list,
+ valobj_list));
+
+ if (valobj_list.GetSize())
+ valobj_sp = valobj_list.GetValueObjectAtIndex(0);
+ }
+
if (valobj_sp) {
AddressType addr_type;
addr = valobj_sp->GetAddressOf(false, &addr_type);