[Lldb-commits] [PATCH] D109738: [lldb] Fix bug 38317 - Address breakpoints don't work if set before the process launches

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 14 15:37:17 PDT 2021


jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

In the future, can you generate patches with context (i.e. pass -U9999 to "git diff" or "git show"), it's a lot easier to read patches with context.

This doesn't seem like the right solution to the problem to me.  The way address breakpoints SHOULD work  is that when you set the breakpoint, we resolve the address you pass in against the images in the target.  If the address is in an image in the list, then we convert the load address to a section relative address before making the breakpoint.  Address breakpoints made that way will always return true for m_addr.GetSection(), and so set re_resolve to true before getting to the test you modified.

OTOH, lldb is a bit hesitant to reset raw load address breakpoints that aren't in any module.  After all, you have no idea, what with loading & unloading & the effects of ASLR, a raw address doesn't have much meaning run to run.

In your case, you have an address that's clearly in a section, so it should have been handled by the if(m_addr.GetSection() || m_module_filespec) test.  So the correct fix is to figure out how you ended up with a non-section relative address for the breakpoint.

I don't want lldb to silently reset non-section relative addresses.  The only way those should show up is if you set the breakpoint on some code that was NOT in any section, maybe JIT code or something, and lldb has no way of knowing what to do with those addresses on re-run.  Refusing to re-resolve them may be too harsh, but we should at least warn about them.  Whereas if the address is section relative, we can always do the right thing.

So the most important thing here is to make sure that address breakpoints always have section relative addresses if we can by any means identify the section they belong in.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109738



More information about the lldb-commits mailing list