Skip to content

Commit

Permalink
Revert "[lldb] Consider binary as module of last resort"
Browse files Browse the repository at this point in the history
This reverts commit a3c3482.
It broke LLDB API test TestBadAddressBreakpoints.py

Differential revision: https://reviews.llvm.org/D124731
  • Loading branch information
omjavaid committed May 23, 2022
1 parent 8c40e16 commit b876c23
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 68 deletions.
27 changes: 8 additions & 19 deletions lldb/source/Breakpoint/BreakpointResolverAddress.cpp
Expand Up @@ -121,27 +121,16 @@ Searcher::CallbackReturn BreakpointResolverAddress::SearchCallback(

if (filter.AddressPasses(m_addr)) {
if (breakpoint.GetNumLocations() == 0) {
// If the address is just an offset ...
if (!m_addr.IsSectionOffset()) {
ModuleSP containing_module_sp = nullptr;
// 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) {
Target &target = breakpoint.GetTarget();
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) {
ModuleSpec module_spec(m_module_filespec);
ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec);
if (module_sp) {
Address tmp_address;
if (containing_module_sp->ResolveFileAddress(m_addr.GetOffset(),
tmp_address))
if (module_sp->ResolveFileAddress(m_addr.GetOffset(), tmp_address))
m_addr = tmp_address;
}
}
Expand Down
6 changes: 2 additions & 4 deletions lldb/source/Commands/Options.td
Expand Up @@ -128,15 +128,13 @@ let Command = "breakpoint set" in {
Arg<"AddressOrExpression">, Required,
Desc<"Set the breakpoint at the specified address. If the address maps "
"uniquely to a particular binary, then the address will be converted to "
"a \"file\" address, so that the breakpoint will track that binary+offset "
"a \"file\"address, so that the breakpoint will track that binary+offset "
"no matter where the binary eventually loads. Alternately, if you also "
"specify the module - with the -s option - then the address will be "
"treated as a file address in that module, and resolved accordingly. "
"Again, this will allow lldb to track that offset on subsequent reloads. "
"The module need not have been loaded at the time you specify this "
"breakpoint, and will get resolved when the module is loaded. If no "
"module is specified, the binary being debugged is considered as a "
"fallback.">;
"breakpoint, and will get resolved when the module is loaded.">;
def breakpoint_set_name : Option<"name", "n">, Group<3>, Arg<"FunctionName">,
Completion<"Symbol">, Required,
Desc<"Set the breakpoint by function name. Can be repeated multiple times "
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit b876c23

Please sign in to comment.