[Lldb-commits] [lldb] r179876 - Fixed two problems when reading constant/register

Sean Callanan scallanan at apple.com
Fri Apr 19 12:47:33 PDT 2013


Author: spyffe
Date: Fri Apr 19 14:47:32 2013
New Revision: 179876

URL: http://llvm.org/viewvc/llvm-project?rev=179876&view=rev
Log:
Fixed two problems when reading constant/register
variables in the ValueObject code:

  - Report an error if the variable does not have
    a valid address.

  - Return the contents of the data to GetData(),
    even if the value is constant.

<rdar://problem/13690855>

Modified:
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/Expression/Materializer.cpp

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=179876&r1=179875&r2=179876&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Apr 19 14:47:32 2013
@@ -1007,7 +1007,17 @@ ValueObject::GetData (DataExtractor& dat
     ExecutionContext exe_ctx (GetExecutionContextRef());
     Error error = m_value.GetValueAsData(&exe_ctx, GetClangAST(), data, 0, GetModule().get());
     if (error.Fail())
-        return 0;
+    {
+        if (m_data.GetByteSize())
+        {
+            data = m_data;
+            return data.GetByteSize();
+        }
+        else
+        {
+            return 0;
+        }
+    }
     data.SetAddressByteSize(m_data.GetAddressByteSize());
     data.SetByteOrder(m_data.GetByteOrder());
     return data.GetByteSize();
@@ -3832,6 +3842,13 @@ ValueObject::AddressOf (Error &error)
             break;
         }
     }
+    else
+    {
+        StreamString expr_path_strm;
+        GetExpressionPath(expr_path_strm, true);
+        error.SetErrorStringWithFormat("'%s' doesn't have a valid address", expr_path_strm.GetString().c_str());
+    }
+    
     return m_addr_of_valobj_sp;
 }
 

Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=179876&r1=179875&r2=179876&view=diff
==============================================================================
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Fri Apr 19 14:47:32 2013
@@ -521,7 +521,7 @@ public:
     }
     
     void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                                lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
+                        lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 





More information about the lldb-commits mailing list