[Lldb-commits] [lldb] 3775be2 - Target: correct the return value for `GetImageAddrFromToken`

Saleem Abdulrasool via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 6 17:38:36 PDT 2020


Author: Saleem Abdulrasool
Date: 2020-04-06T17:37:57-07:00
New Revision: 3775be2d8e17aaeae62ab83ded005867f4bf70ac

URL: https://github.com/llvm/llvm-project/commit/3775be2d8e17aaeae62ab83ded005867f4bf70ac
DIFF: https://github.com/llvm/llvm-project/commit/3775be2d8e17aaeae62ab83ded005867f4bf70ac.diff

LOG: Target: correct the return value for `GetImageAddrFromToken`

We would return `LLDB_INVALID_IMAGE_TOKEN` for the address rather than
the correct value of `LLDB_IMAGE_ADDRESS`.  This would result in the
check for the return value to silently pass on x64 as the invalid
address and invalid token are of different sizes (`size_t` vs
`uintprr_t`).  This corrects the return value to `LLDB_INVALID_ADDRESS`
and addresses the rest to reset the mapped address to the invalid value.

This was found by inspection when trying to implement module support for
Windows.

Added: 
    

Modified: 
    lldb/source/Target/Process.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index a39999776f95..7797a4c60964 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -5796,12 +5796,12 @@ size_t Process::AddImageToken(lldb::addr_t image_ptr) {
 lldb::addr_t Process::GetImagePtrFromToken(size_t token) const {
   if (token < m_image_tokens.size())
     return m_image_tokens[token];
-  return LLDB_INVALID_IMAGE_TOKEN;
+  return LLDB_INVALID_ADDRESS;
 }
 
 void Process::ResetImageToken(size_t token) {
   if (token < m_image_tokens.size())
-    m_image_tokens[token] = LLDB_INVALID_IMAGE_TOKEN;
+    m_image_tokens[token] = LLDB_INVALID_ADDRESS;
 }
 
 Address


        


More information about the lldb-commits mailing list