summaryrefslogtreecommitdiff
path: root/source/Breakpoint/Watchpoint.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
commitead246455adf1a215ec2715dad6533073a6beb4e (patch)
treef3f97a47d77053bf96fe74cdbd6fae74380e8a92 /source/Breakpoint/Watchpoint.cpp
parentfdb00c4408990a0a63ef7f496d809ce59f263bc5 (diff)
Notes
Diffstat (limited to 'source/Breakpoint/Watchpoint.cpp')
-rw-r--r--source/Breakpoint/Watchpoint.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/Breakpoint/Watchpoint.cpp b/source/Breakpoint/Watchpoint.cpp
index e8a926527d24b..17dcda13e9b92 100644
--- a/source/Breakpoint/Watchpoint.cpp
+++ b/source/Breakpoint/Watchpoint.cpp
@@ -13,10 +13,11 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectMemory.h"
#include "lldb/Expression/UserExpression.h"
-#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
using namespace lldb;
@@ -30,14 +31,22 @@ Watchpoint::Watchpoint(Target &target, lldb::addr_t addr, uint32_t size,
m_watch_write(0), m_watch_was_read(0), m_watch_was_written(0),
m_ignore_count(0), m_false_alarms(0), m_decl_str(), m_watch_spec_str(),
m_type(), m_error(), m_options(), m_being_created(true) {
+
if (type && type->IsValid())
m_type = *type;
else {
// If we don't have a known type, then we force it to unsigned int of the
// right size.
- ClangASTContext *ast_context = target.GetScratchClangASTContext();
- m_type = ast_context->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint,
- 8 * size);
+ auto type_system_or_err =
+ target.GetScratchTypeSystemForLanguage(eLanguageTypeC);
+ if (auto err = type_system_or_err.takeError()) {
+ LLDB_LOG_ERROR(
+ lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS),
+ std::move(err), "Failed to set type.");
+ } else {
+ m_type = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize(
+ eEncodingUint, 8 * size);
+ }
}
// Set the initial value of the watched variable: