aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectWatchpoint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index 63275f9..d3b2243 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -1056,6 +1056,8 @@ protected:
valobj_sp = valobj_list.GetValueObjectAtIndex(0);
}
+ ClangASTType type;
+
if (valobj_sp) {
AddressType addr_type;
addr = valobj_sp->GetAddressOf(false, &addr_type);
@@ -1065,6 +1067,7 @@ protected:
size = m_option_watchpoint.watch_size == 0 ? valobj_sp->GetByteSize()
: m_option_watchpoint.watch_size;
}
+ type.SetClangType(valobj_sp->GetClangAST(), valobj_sp->GetClangType());
} else {
const char *error_cstr = error.AsCString(NULL);
if (error_cstr)
@@ -1078,7 +1081,7 @@ protected:
// Now it's time to create the watchpoint.
uint32_t watch_type = m_option_watchpoint.watch_type;
error.Clear();
- Watchpoint *wp = target->CreateWatchpoint(addr, size, watch_type, error).get();
+ Watchpoint *wp = target->CreateWatchpoint(addr, size, &type, watch_type, error).get();
if (wp) {
wp->SetWatchSpec(command.GetArgumentAtIndex(0));
wp->SetWatchVariable(true);
@@ -1088,9 +1091,6 @@ protected:
var_sp->GetDeclaration().DumpStopContext(&ss, true);
wp->SetDeclInfo(ss.GetString());
}
- StreamString ss;
- ValueObject::DumpValueObject(ss, valobj_sp.get());
- wp->SetNewSnapshot(ss.GetString());
output_stream.Printf("Watchpoint created: ");
wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
output_stream.EOL();
@@ -1265,8 +1265,15 @@ protected:
// Now it's time to create the watchpoint.
uint32_t watch_type = m_option_watchpoint.watch_type;
+
+ // Fetch the type from the value object, the type of the watched object is the pointee type
+ /// of the expression, so convert to that if we found a valid type.
+ ClangASTType type(valobj_sp->GetClangAST(), valobj_sp->GetClangType());
+ if (type.IsValid())
+ type.SetClangType(type.GetASTContext(), type.GetPointeeType());
+
Error error;
- Watchpoint *wp = target->CreateWatchpoint(addr, size, watch_type, error).get();
+ Watchpoint *wp = target->CreateWatchpoint(addr, size, &type, watch_type, error).get();
if (wp) {
if (var_sp && var_sp->GetDeclaration().GetFile()) {
StreamString ss;
@@ -1275,11 +1282,6 @@ protected:
wp->SetDeclInfo(ss.GetString());
}
output_stream.Printf("Watchpoint created: ");
- uint64_t val = target->GetProcessSP()->ReadUnsignedIntegerFromMemory(addr, size, 0, error);
- if (error.Success())
- wp->SetNewSnapshotVal(val);
- else
- output_stream.Printf("watchpoint snapshot failed: %s", error.AsCString());
wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
output_stream.EOL();
result.SetStatus(eReturnStatusSuccessFinishResult);