From 7aa043afd909dd118576affb8660d283de942611 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Mon, 26 Sep 2011 18:05:16 +0000 Subject: [PATCH] Modify SBFrame::WatchValue() impl so that for the watchpoint location created, it also populates the variable declaration location if possible. llvm-svn: 140540 --- lldb/source/API/SBFrame.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index c4fc392b98d4..ac1a84ead1d5 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -440,6 +440,18 @@ SBFrame::WatchValue (const char *name, ValueType value_type, uint32_t watch_type WatchpointLocationSP wp_loc_sp = m_opaque_sp->GetThread().GetProcess().GetTarget(). CreateWatchpointLocation(addr, size, watch_type); + if (wp_loc_sp) { + // StackFrame::GetInScopeVariableList(true) to get file globals as well. + VariableListSP var_list_sp(m_opaque_sp->GetInScopeVariableList(true)); + VariableSP var_sp = var_list_sp->FindVariable(ConstString(name)); + if (var_sp && var_sp->GetDeclaration().GetFile()) { + StreamString ss; + // True to show fullpath for declaration file. + var_sp->GetDeclaration().DumpStopContext(&ss, true); + wp_loc_sp->SetDeclInfo(ss.GetString()); + } + } + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBFrame(%p)::WatchValue (name=\"%s\", value_type=%i, watch_type=%i) => SBValue(%p) & wp_loc(%p)",