[Lldb-commits] [PATCH] D71498: Fix ARM32 inferior calls

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Dec 21 00:06:08 PST 2019


labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Thanks for tracking these down!



================
Comment at: lldb/source/Expression/IRMemoryMap.cpp:577-586
   if (lldb_private::Log *log =
           lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
     LLDB_LOGF(log,
               "IRMemoryMap::WriteMemory (0x%" PRIx64 ", 0x%" PRIx64
               ", 0x%" PRId64 ") went to [0x%" PRIx64 "..0x%" PRIx64 ")",
-              (uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
-              (uint64_t)allocation.m_process_start,
+              (uint64_t)process_address, (uint64_t)(uintptr_t)bytes,
+              (uint64_t)size, (uint64_t)allocation.m_process_start,
----------------
jankratochvil wrote:
> labath wrote:
> > This could be something `LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS), "({0:x}, {1:x}, {2:x}) went to [{3:x}, {4:x})", process_address, bytes, allocation.m_process_start, allocation.m_process_start + allocation.m_size)`
> I haven't changed the log function, that could be a different patch, that goes too far IMO.
PRIxPTR is fine too, though I wouldn't really consider changing the log method as "going too far". I tend to do that for all non-trivial modifications to log statements that I make...


================
Comment at: lldb/source/Host/common/HostInfoBase.cpp:250
+      reinterpret_cast<void *>(
+          HostInfoBase::ComputeSharedLibraryDirectory)));
 
----------------
jankratochvil wrote:
> The source is a `static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);` and destination is `void *` so there is no intermediate integer cast needed: [[ https://stackoverflow.com/a/2613393/2995591 | Casting pointer to object to void * in C++ ]]
> It was caught by D71707 as `intptr_t` is dangerous.
> 
I seem to recall some compilers complaining (though still accepting) about code which casts function pointers to void*, with this being the only available workaround. However, I can't reproduce this now, so I guess this could be fine..


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71498/new/

https://reviews.llvm.org/D71498





More information about the lldb-commits mailing list