[Lldb-commits] [PATCH] D13202: [LLDB] Fix display of value of a vector variables in watchpoint operations

Mohit Bhakkad via lldb-commits lldb-commits at lists.llvm.org
Sun Sep 27 23:32:39 PDT 2015


mohit.bhakkad created this revision.
mohit.bhakkad added reviewers: clayborg, granata.enrico.
mohit.bhakkad added subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits.
mohit.bhakkad set the repository for this revision to rL LLVM.

Consider a vector variable 'v8i16 s0'

Right now if we print value of s0, it gives us proper value: 
(lldb) print s0
(v8i16) $0 = (member 1, member 2, ........,member 8)

But if we try to set a watchpoint on it, it shows null for its value:

(lldb) watchpoint set variable s0
Watchpoint created: Watchpoint 1: addr = <addr> size = 16 state = enabled type = w
    declare @ 'file_name:line_no'
    watchpoint spec = 's0'
    new value: (null)

Approach used in patch is already used in in function ValueObjectPrinter::GetValueSummaryError, 
which is called for command 'print s0'.

Repository:
  rL LLVM

http://reviews.llvm.org/D13202

Files:
  source/Breakpoint/Watchpoint.cpp

Index: source/Breakpoint/Watchpoint.cpp
===================================================================
--- source/Breakpoint/Watchpoint.cpp
+++ source/Breakpoint/Watchpoint.cpp
@@ -218,14 +218,21 @@
         s->Printf("\nWatchpoint %u hit:", GetID());
         prefix = "";
     }
-    
+
     if (m_old_value_sp)
     {
-        s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString());
+        if (m_old_value_sp->GetValueAsCString())
+            s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString());
+        else
+            s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetSummaryAsCString());
     }
+
     if (m_new_value_sp)
     {
-        s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString());
+        if (m_new_value_sp->GetValueAsCString())
+            s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString());
+        else
+            s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetSummaryAsCString());
     }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13202.35835.patch
Type: text/x-patch
Size: 1043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150928/757781e0/attachment.bin>


More information about the lldb-commits mailing list