da-viper wrote:

> @da-viper, thanks for sharing the idea! I will add the test.
> 
> My only concern is that the source line after the `bar()` call may not be the 
> instruction after the call instruction, for example, compiler may emit extra 
> code after call instruction.

I do not think in this test case the compiler will emit any code after the 
`bar()` call instruction that does not have a line entry. 

The tests are run without optimisation by default. the `#line` directive forces 
all lines after it to be relative for example

```cpp
bool foo() {                                 // line 1
  bar();                                     // line 2
#line 0 "test.cpp"                     
  return true;                               // line 0
}                                            // line 1
                                             // line 2
int main () {                                // line 3
   return 0;                                 // line 4
}                                            // line 5
```
that's why I forward declared `foo` and `foo's` definition is the last function 
in the test case. 

>  So this test depends on the assumption that there is no extra code between 
> call instruction and next source line. 

No, it makes sure that any instruction after the `bar()` call does not have a 
valid line entry. That way we can test the frames in the stack trace will have 
a valid source line entry. 

https://github.com/llvm/llvm-project/pull/165944
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to