[Lldb-commits] [PATCH] D139226: Don't mark DW_OP_addr addresses as file addresses while converting them to load addresses sometimes

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 2 13:22:33 PST 2022


jasonmolenda created this revision.
jasonmolenda added a reviewer: aprantl.
jasonmolenda added a project: LLDB.
Herald added subscribers: Michael137, JDevlieghere, arichardson.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

I touched this code in DWARFExpression.cpp https://reviews.llvm.org/D137682 where it would convert a DW_OP_addr to a load address if the ExecutionContext had a StackFrame available.  This was a proxy way of telling if there was a live process.  I changed it to do this conversion if the ExecutionContext had a *Target*, to make it possible to write a test case that would move a section around to different load addresses without ever creating a process.  This, it turns out, broke a use case on another platform that Ted Woodward relayed to me.

This code to convert the address to a load address was added by Adrian in 2018 via https://reviews.llvm.org/D46362 for swift reasons.  I'm not sure it was entirely the correct way to solve this, but it has since become quite unnecessary for Swift -- in fact, on Darwin platforms, global addresses before execution are no longer even file addresses, they're part of the dynamic linker (dyld) fixup data and lldb does not know how to parse these.  For instance, `static char *f = "hi";` in a program, `f` will have the address of the string bytes.  Before and after process execution, lldb must read this address out of the binary, and it is not in any format that lldb can correctly map to a section+offset in the binary.  So this change is very definitely not necessary on Darwin today; we can't parse these addresses at all.

Given that this is breaking a use case on another platform, I'm removing Adrian's DW_OP_addr conversion, and removing my test case for the high memory special address testing.  I can't find a way to fake up an address space well enough to make this work the way it needs to, for now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139226

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/test/API/lang/c/high-mem-global/Makefile
  lldb/test/API/lang/c/high-mem-global/TestHighMemGlobal.py
  lldb/test/API/lang/c/high-mem-global/main.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139226.479726.patch
Type: text/x-patch
Size: 4006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221202/ee8d339e/attachment-0001.bin>


More information about the lldb-commits mailing list