From ead246455adf1a215ec2715dad6533073a6beb4e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 23 Oct 2019 17:53:01 +0000 Subject: Vendor import of stripped lldb trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/lldb/trunk@375505 --- source/Breakpoint/Watchpoint.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'source/Breakpoint/Watchpoint.cpp') 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: -- cgit v1.2.3