[Lldb-commits] [PATCH] D124731: [lldb] Consider binary as module of last resort
Will Hawkins via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 6 16:56:37 PDT 2022
hawkinsw updated this revision to Diff 427791.
hawkinsw added a comment.
Updated patch including responses to helpful feedback from @jingham.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124731/new/
https://reviews.llvm.org/D124731
Files:
lldb/source/Breakpoint/BreakpointResolverAddress.cpp
Index: lldb/source/Breakpoint/BreakpointResolverAddress.cpp
===================================================================
--- lldb/source/Breakpoint/BreakpointResolverAddress.cpp
+++ lldb/source/Breakpoint/BreakpointResolverAddress.cpp
@@ -121,16 +121,27 @@
if (filter.AddressPasses(m_addr)) {
if (breakpoint.GetNumLocations() == 0) {
- // If the address is just an offset, and we're given a module, see if we
- // can find the appropriate module loaded in the binary, and fix up
- // m_addr to use that.
- if (!m_addr.IsSectionOffset() && m_module_filespec) {
+ // If the address is just an offset ...
+ if (!m_addr.IsSectionOffset()) {
+ ModuleSP containing_module_sp = nullptr;
Target &target = breakpoint.GetTarget();
- ModuleSpec module_spec(m_module_filespec);
- ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec);
- if (module_sp) {
+ if (m_module_filespec) {
+ // ... and we're given a module, see if we can find the
+ // appropriate module loaded in the binary, and fix up
+ // m_addr to use that.
+ ModuleSpec module_spec(m_module_filespec);
+ containing_module_sp =
+ target.GetImages().FindFirstModule(module_spec);
+ } else {
+ // ... and we're not given a module, see if the offset is
+ // somewhere in the executable module. If it is, then we'll
+ // fix up m_addr to use that.
+ containing_module_sp = target.GetExecutableModule();
+ }
+ if (containing_module_sp) {
Address tmp_address;
- if (module_sp->ResolveFileAddress(m_addr.GetOffset(), tmp_address))
+ if (containing_module_sp->ResolveFileAddress(m_addr.GetOffset(),
+ tmp_address))
m_addr = tmp_address;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124731.427791.patch
Type: text/x-patch
Size: 1917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220506/7b99bba4/attachment.bin>
More information about the lldb-commits
mailing list