[Lldb-commits] [PATCH] D71372: [lldb] Add additional validation on return address in 'thread step-out'

Mark Mossberg via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 11 13:42:36 PST 2019


mossberg marked 2 inline comments as done.
mossberg added inline comments.


================
Comment at: lldb/source/Target/ThreadPlanStepOut.cpp:127-129
+    if (!return_address_section) {
+      LLDB_LOGF(log, "Return address had no section.");
+      return;
----------------
clayborg wrote:
> This will fail for JIT'ed code. Best to ask the process for memory region information since it will usually be complete mappings for the process, even if we have no file on disk for the region in question:
> 
> ```
> uint32_t permissions = 0;
> const addr_t return_pc = return_address.GetLoadAddr(&m_thread.GetProcess()->GetTarget());
> if (!m_thread.GetProcess()->GetLoadAddressPermissions(return_pc, permissions)) {
>   LLDB_LOGF(log, "No permissions for PC.");
>   return;
> } else if (!(permissions & ePermissionsExecutable)) {
>   LLDB_LOGF(log, "Return address did not point to executable memory.");
>   return;
> }
> ```
> 
> The issue is we don't always have an object file for stuff we debug. If we rely on having an object file, like to require sections as your solution did, then this will fail for any JIT'ed code or any code that we weren't able to find object files for (remote debugging where we might not have all files).
> 
> 
Thanks @clayborg! Updated the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71372





More information about the lldb-commits mailing list