Open Quuxplusone opened 3 years ago
Attached a.out
(9352 bytes, application/x-executable): binary
This is probably duplicate with https://bugs.llvm.org/show_bug.cgi?id=48467 and
I suspect both are intentional behavior.
Here's a simple example:
1: void f1() { }
2: __attribute__((always_inline)) void f2() { f1(); }
3: int main() {
4: f1();
5: f2();
6: }
(the first f1() call isn't strictly necessary, but makes things a bit more
obvious/clearer I think)
If you step through main - you go something like 4, 1, 5, 2, 1, 2, 6. the {5,
2} portion are at the same instruction. This is lldb synthesizing what it would
be like to be at the call, but before executing the call, then stepping into
the function call - the experience you would get with a real function call,
but. with an inlined function call those two locations exist at the same
instruction - so lldb has synthesized the experience of them being distinct
locations.
But 'si' does what it says: steps to the next instruction - so in favoring the
literal definition of the next instruction, no frame is synthesized.
(In reply to David Blaikie from comment #1)
This is probably duplicate with https://bugs.llvm.org/show_bug.cgi?id=48467 and I suspect both are intentional behavior.
Here's a simple example:
1: void f1() { } 2: attribute((always_inline)) void f2() { f1(); } 3: int main() { 4: f1(); 5: f2(); 6: }
(the first f1() call isn't strictly necessary, but makes things a bit more obvious/clearer I think)
If you step through main - you go something like 4, 1, 5, 2, 1, 2, 6. the {5, 2} portion are at the same instruction. This is lldb synthesizing what it would be like to be at the call, but before executing the call, then stepping into the function call - the experience you would get with a real function call, but. with an inlined function call those two locations exist at the same instruction - so lldb has synthesized the experience of them being distinct locations.
But 'si' does what it says: steps to the next instruction - so in favoring the literal definition of the next instruction, no frame is synthesized.
Thanks. I agree and understand that this is indeed an inlined function call. The current form will mislead developers into thinking that stepping is not moving forward. Thus, I was wondering whether it is possible for lldb to behave as step a new instruction like si
when stepping a new line?
(In reply to Yibiao Yang from comment #2)
(In reply to David Blaikie from comment #1)
This is probably duplicate with https://bugs.llvm.org/show_bug.cgi?id=48467 and I suspect both are intentional behavior.
Here's a simple example:
1: void f1() { } 2: attribute((always_inline)) void f2() { f1(); } 3: int main() { 4: f1(); 5: f2(); 6: }
(the first f1() call isn't strictly necessary, but makes things a bit more obvious/clearer I think)
If you step through main - you go something like 4, 1, 5, 2, 1, 2, 6. the {5, 2} portion are at the same instruction. This is lldb synthesizing what it would be like to be at the call, but before executing the call, then stepping into the function call - the experience you would get with a real function call, but. with an inlined function call those two locations exist at the same instruction - so lldb has synthesized the experience of them being distinct locations.
But 'si' does what it says: steps to the next instruction - so in favoring the literal definition of the next instruction, no frame is synthesized.
Thanks. I agree and understand that this is indeed an inlined function call. The current form will mislead developers into thinking that stepping is not moving forward. Thus, I was wondering whether it is possible for lldb to behave as step a new instruction like
si
when stepping a new line?
Can't say I know - perhaps someone from lldb will chime in. My guess would be the current behavior's the best default, but perhaps there's a flag/mode/option/something to opt out of this behavior.
a.out
(9352 bytes, application/x-executable)