[Lldb-commits] [PATCH] D32022: Fix backtrace of noreturn functions situated at the end of a module

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 20 22:38:31 PDT 2017

jasonmolenda added a comment.

Hi Pavel, I'd document the new flag in include/lldb/Core/Address.h where we have documentation for the other flags being used.

It seems like we're fixing this a little indirectly, and I'm not sure it's the best approach.  I want to make sure I understand the situation correctly.

Say we have an object file with three sections

s1 0..99  (offset 0, size 100)
s2 100..199 (offset 100, size 100)
s3 200.299 (offset 200, size 100)

We have a noreturn function whose last instruction ends on the last byte of s2, so the saved return address is offset 200.  Your change makes it so that when we say "is 200 contained within 100..199", we will say yes, it is.  This gets us the correct Section for our symbol context and when we back up the pc value by one (the "decr_pc_and_recompute_addr_range = true" bit in RegisterContextLLDB::InitializeNonZerothFrame) so when we back up the offset within the section by 1, we're good.

The current behavior is that we pick the wrong section (s3) and somehow backing up the pc isn't working.

Maybe we can accomplish the same fix by looking at the if (decr_pc_and_recompute_addr_range) block of code?  Is decr_pc_and_recompute_addr_range not being set for this case?  Are we not correctly backing up the pc into the Section boundary correctly?

I have access to a linux machine so I can play with this myself, but it will take me a while to set up lldb on that system, could you let me know if you looked at this approach?  I know RegisterContextLLDB is complicated and it's easy to miss things - or it may be that you tried this approach and it didn't look possible.   (and I haven't had to touch this code in a few years so I may have forgotten about some "new Section is the same as the old Section" sanity check or something in there... I don't see it right now, but I may have missed it.)


More information about the lldb-commits mailing list