[lldb-dev] Problem unwinding from inside of a CRT function
jingham at apple.com
jingham at apple.com
Thu Jan 15 18:30:42 PST 2015
> On Jan 15, 2015, at 5:01 PM, Zachary Turner <zturner at google.com> wrote:
> Btw, I'm still a little uncomfortable that not having unwind/ symbol info at any point no matter how deep in a function call chain, has the possibility to mess up a step over. In my original example, i had symbols for main but not printf. Is that not sufficient to step over a call to printf? It should be able to know from that a) the bounds of main(), b) the pc corresponding to the next line of source after printf, and c) the value of esp. Aren't those 3 pieces of information enough to step over any line of source, regardless of whether you have unwind information for the code inside the function you're stepping over?
The stepping machinery is not architecture specific, nor should it be. It's the unwinder's job to get the stack frames right on a per-architecture basis, and then the stepping machinery is the consumer of the unwind info. The stepping machinery also needs to know things like "how to I get back out of a function that I stepped into" which again rely on the unwind being accurate.
> On Thu, Jan 15, 2015 at 4:36 PM <jingham at apple.com> wrote:
> > On Jan 15, 2015, at 4:18 PM, Zachary Turner <zturner at google.com> wrote:
> > Which is unfortunate, because it seems to be needed even for basic stepping to work, like step over. Originally I was just trying to implement stepping, and that's how I ran into this issue. So that brings me to a related question. Why is step over as complicated as it is? It seems to me like step over can be implemented by disassembling 1 opcode, adding the size of the opcode to the current pc, and having the ThreadPlan::ShouldStop always return false unless the pc is equal to old_pc + size_of_opcode.
> You are describing "thread step-inst". That should pretty much always work regardless of unwinder, etc.
> Source step over, as Jason said, is much more complicated.
More information about the lldb-dev