[lldb] finish error: Could not create return address breakpoint.
$ lldb -v
lldb-1316.0.9.46
Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)
$ cat small.c
int main()
{
int j = 0, d = 0;
if (j>=0)
for (; d; d++)
return 0;
return 0;
}
$ clang -g small.c; lldb a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) b 7
Breakpoint 1: where = a.out`main + 67 at small.c:7:3, address = 0x0000000100003fa3
(lldb) r
Process 17368 launched: 'a.out' (x86_64)
Process 17368 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100003fa3 a.out`main at small.c:7:3
4 if (j>=0)
5 for (; d; d++)
6 return 0;
-> 7 return 0;
8 }
Target 0: (a.out) stopped.
(lldb) s
Process 17368 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x0000000100003faa a.out`main at small.c:8:1
5 for (; d; d++)
6 return 0;
7 return 0;
-> 8 }
Target 0: (a.out) stopped.
(lldb) s
Process 17368 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x000000010000d51e dyld`start + 462
dyld`start:
-> 0x10000d51e <+462>: movl %eax, %r14d
0x10000d521 <+465>: movq 0x8(%rbx), %rax
0x10000d525 <+469>: movl 0x34(%rax), %edi
0x10000d528 <+472>: xorl %esi, %esi
Target 0: (a.out) stopped.
(lldb) finish
error: Could not create return address breakpoint.
(lldb)
@llvm/issue-subscribers-lldb
It looks from the transcript like there's only one frame left at the point where you do finish - you stepped back out to dyld_start before trying to do "finish"... finish isn't continue, it does not run unconstrainedly, but requires there to be an older frame to return to, which it doesn't look like you have here.
So far as I can tell the only misbehavior here is that the error message is a little too generic.
Jim
On May 19, 2022, at 12:29 AM, yangyibiao @.***> wrote:
$ lldb -v lldb-1316.0.9.46 Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)
$ cat small.c int main() { int j = 0, d = 0; if (j>=0) for (; d; d++) return 0; return 0; }
$ clang -g small.c; lldb a.out (lldb) target create "a.out" Current executable set to 'a.out' (x86_64). (lldb) b 7 Breakpoint 1: where = a.out`main + 67 at small.c:7:3, address = 0x0000000100003fa3 (lldb) r Process 17368 launched: 'a.out' (x86_64) Process 17368 stopped
thread #1 https://github.com/llvm/llvm-project/pull/1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x0000000100003fa3 a.out
main at small.c:7:3 4 if (j>=0) 5 for (; d; d++) 6 return 0; -> 7 return 0; 8 } Target 0: (a.out) stopped. (lldb) s Process 17368 stopped thread #1 <https://github.com/llvm/llvm-project/pull/1>, queue = 'com.apple.main-thread', stop reason = step in frame #0: 0x0000000100003faa a.outmain at small.c:8:1 5 for (; d; d++) 6 return 0; 7 return 0; -> 8 } Target 0: (a.out) stopped. (lldb) s Process 17368 stopped thread #1 https://github.com/llvm/llvm-project/pull/1, queue = 'com.apple.main-thread', stop reason = step in frame #0: 0x000000010000d51e dyldstart + 462 dyldstart: -> 0x10000d51e <+462>: movl %eax, %r14d 0x10000d521 <+465>: movq 0x8(%rbx), %rax 0x10000d525 <+469>: movl 0x34(%rax), %edi 0x10000d528 <+472>: xorl %esi, %esi Target 0: (a.out) stopped. (lldb) finish error: Could not create return address breakpoint. (lldb) — Reply to this email directly, view it on GitHub https://github.com/llvm/llvm-project/issues/55581, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUPVW4IFZZ53AXMMQFMG5DVKXUTZANCNFSM5WLHEVQA. You are receiving this because you are subscribed to this thread.
Thanks. Indeed, there is only one frame left. Yes, lldb should not emit an error message here. When I runing the same test program in other version of lldb, lldb left a message with process xxx exited with status = 0. I think this should be the expected and correct behavior of lldb.
I disagree. If "finish" can't find a frame to finish out to, it should report an error and do nothing.
For instance, suppose you had just stepped into a section of code which the unwinder didn't understand in a way that caused lldb to think there's just one frame. If you did "finish" in that instance, you probably wouldn't appreciate lldb turning your bounded finish operation into an unbounded continue. It would rob you of the chance to get the debug session back to a place where it could unwind again (by judicious use of "ni" or whatever) and then into the function you were planning to "finish" out to.
Jim
On May 19, 2022, at 9:41 AM, yangyibiao @.***> wrote:
Thanks. Indeed, there is only one frame left. Yes, lldb should not emit an error message here. When I runing the same test program in other version of lldb, lldb left a message with process xxx exited with status = 0. I think this should be the expected and correct behavior of lldb.
— Reply to this email directly, view it on GitHub https://github.com/llvm/llvm-project/issues/55581#issuecomment-1131945532, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUPVW4H7NKKWHB6XX6R7ODVKZVMHANCNFSM5WLHEVQA. You are receiving this because you are on a team that was mentioned.
Thanks for this explaination. I agree that it is acceptable that the debugger reports an error for this case. But I was wondering that would it be better if the debugger behaves consistent across different versions.
---yibiao
------------------ Original ------------------ From: @.>; Date: Fri, May 20, 2022 02:48 AM To: @.>; Cc: @.>; @.>; Subject: Re: [llvm/llvm-project] [lldb] finish error: Could not create return address breakpoint. (Issue #55581)
I disagree. If "finish" can't find a frame to finish out to, it should report an error and do nothing.
For instance, suppose you had just stepped into a section of code which the unwinder didn't understand in a way that caused lldb to think there's just one frame. If you did "finish" in that instance, you probably wouldn't appreciate lldb turning your bounded finish operation into an unbounded continue. It would rob you of the chance to get the debug session back to a place where it could unwind again (by judicious use of "ni" or whatever) and then into the function you were planning to "finish" out to.
Jim
> On May 19, 2022, at 9:41 AM, yangyibiao @.***> wrote: > > > Thanks. Indeed, there is only one frame left. Yes, lldb should not emit an error message here. When I runing the same test program in other version of lldb, lldb left a message with process xxx exited with status = 0. I think this should be the expected and correct behavior of lldb. > > — > Reply to this email directly, view it on GitHub <https://github.com/llvm/llvm-project/issues/55581#issuecomment-1131945532>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADUPVW4H7NKKWHB6XX6R7ODVKZVMHANCNFSM5WLHEVQA>. > You are receiving this because you are on a team that was mentioned. >
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>