[Lldb-commits] [PATCH] D11270: Expr evaluation - Avoid to check when the memory handle is zero

Dean De Leo dean at codeplay.com
Thu Jul 16 09:57:14 PDT 2015


dean created this revision.
dean added reviewers: jingham, spyffe.
dean added a subscriber: lldb-commits.

This change avoids to check whether the handle returned for an allocation of memory in IRForTarget::CompleteDataAllocation is zero, which is apparently a valid handle. The method IRForTarget::StaticDataAllocator::Allocate() returns LLDB_INVALID_ADDRESS in case of error, whereas, when the policy is eAllocationPolicyHostOnly, the first allocation performed by IRMemoryMap::Malloc and FindSpace is the value 0 for the first allocation. 

This fix should restore the fall-back mode to evaluate expressions through local interpretation when an allocation by IRForTarget::CompleteDataAllocation is performed.

http://reviews.llvm.org/D11270

Files:
  source/Expression/IRForTarget.cpp

Index: source/Expression/IRForTarget.cpp
===================================================================
--- source/Expression/IRForTarget.cpp
+++ source/Expression/IRForTarget.cpp
@@ -2478,13 +2478,13 @@

     if (log)
     {
-        if (allocation)
+        if (allocation != LLDB_INVALID_ADDRESS)
             log->Printf("Allocated static data at 0x%llx", (unsigned long long)allocation);
         else
             log->Printf("Failed to allocate static data");
     }

-    if (!allocation || allocation == LLDB_INVALID_ADDRESS)
+    if (allocation == LLDB_INVALID_ADDRESS)
         return false;

     Constant *relocated_addr = ConstantInt::get(m_intptr_ty, (uint64_t)allocation);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11270.29920.patch
Type: text/x-patch
Size: 694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150716/1ecb85e8/attachment.bin>


More information about the lldb-commits mailing list