[Lldb-commits] [PATCH] D64769: [lldb][test_suite] change the test main.cpp to avoid expression reschedule
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 17 01:02:28 PDT 2019
labath added a comment.
In D64769#1587992 <https://reviews.llvm.org/D64769#1587992>, @kusmour wrote:
> The test set the breakpoint to the return statement, even thought the compiler flag `-O0` was set, the first hit to that bp showed that `g_common_1 = 0` which actually should be 21. The test assume when we hit the return statement, the value should already be calculated, but that's not the case for NDK20 clang.
> So we reproduce the test manually, turned out that the value was calculated later. lldb first hit the return statement then jump back to line 20. By looking at the assembly that clang provided, it indeed jump back and forth.
> It's possible that the jumping behavior is caused by optimization, considering there're some other tests having similar problem, and the behavior changed a lot from NDK 19 to 20. I made this change because this is irrelevant to testing global variables.
Yeah, this problem isn't a bug in the debugger, but it could be considered a bug in the compiler, as one wouldn't expect the line numbers to jump around like this at -O0. And indeed, if we compare the the ndk r20 clang output with the current ToT, then we can see that they generate nearly identical assembly, but their line numbers differ. So it looks like somebody did consider this to be a bug and fixed it already.
Anyway, working around that here seems fine...
CHANGES SINCE LAST ACTION
More information about the lldb-commits