<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/150014>150014</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            lldb seems to be ignoring [[gnu::artificial]] attribute and breaking in that function rather than caller
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          RedBeard0531
      </td>
    </tr>
</table>

<pre>
    https://clang.llvm.org/docs/AttributeReference.html#artificial
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-artificial-function-attribute

The intent of the attribute is that the function should not show up when debugging and instead, the debugger should interact with the calling function. This works in gdb, but not in lldb. I have tried compiling with both clang and gcc and the results are the same.

```cpp
[[gnu::always_inline, gnu::artificial]]
inline void breakpoint() {
#ifdef __X86_64__
    asm("int3");
#elif defined(__aarch64__)
    asm("brk 0xf000");
#endif
}

int main() {
 breakpoint();
}
```

gdb correctly breaks at the *call* of breakpoint:

```
> gdb --quiet ./a.out   
Reading symbols from ./a.out...
(gdb) r
Starting program: /home/mstearn/tmp/a.out 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at artificial_test.cpp:11
11       breakpoint();
```

lldb on the other hand breaks inside of the breakpoint function:

```
> lldb ./a.out
(lldb) target create "./a.out"
Current executable set to '/home/mstearn/tmp/a.out' (aarch64).
(lldb) r
Process 310838 launched: '/home/mstearn/tmp/a.out' (aarch64)
Process 310838 stopped
* thread #1, name = 'a.out', stop reason = signal SIGTRAP
    frame #0: 0x0000000000400644 a.out`main [inlined] breakpoint() at artificial_test.cpp:6:5
   3    #ifdef __X86_64__
   4     asm("int3");
   5    #elif defined(__aarch64__)
-> 6            asm("brk 0xf000");
   7    #endif
   8    }
   9  
```

Is there some other way to tell lldb to *really* ignore the breakpoint function and never show it when debugging?

For context, I'm trying to have a break-on-failure in a unittest framework appear to break directly on the failing check in the test rather than in internal framework code. For reasons I can't inject the trap directly into the caller and need it to be in an inline artificial function (a destructor to be specific).
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVk2P4ywS_jXkUopFcD4PObinN6u-vZrplfYWYajYbGPIAu6Pf78qcJLuzLZGbxQlNlBPFfU8VCFjNJ1D3LPVA1s9zuSYeh_2P1E_oAyar-rFrPX6Y9-ndI6sbpg4MHFQVrqusvZ1qHzomDhoryIThyalYNox4U88YUCnsOrTYJmoZUjmZJSRlvHmK1inVNW5cULyzhqHE16nFBOHH34YvJsfRqeS8W5-9RIv6MZpfJ_ffMxPl7XyspbxhvHmuUcwLqFL4E-QeoTrAjARUi9THr3YQ-z9aDU4n-jxDcYzvPXoQGM7dp1xHUinwbiYUGomfmTrMonhYk0eg1QJ3kzq8wolrSXji58KnnsT4c2HlwjGQadbAmvHlF0bB9bqtoIn6OUrQgoGNSg_nE2GybitTz1kZnJMnVL5n9wFjKNNEWTA_B7lgFXJCFvz8lXnM72SDh46NxI9dSPtm_yIR5NJoYhuMzdCV4_05U1ZBa_eaGgDypezNy4xsWViB2zzQPCiNieNJzge_71dH9fL45HxBgBAxiGvFMalmgnBxI7VkwlacwKNJxIGE9vjUcqg-mwsdvf2bXgB_n7inN-jOG1O9Lh5LFs3LsEgjfsS4W-RT_bF6JKsAtDpFpQPAVWyH8UwwqQgJhoimYmGlPYJtG7uEk_P9T-IcpjP_zsaTFAxcZCVHxMAMN78RKmJ5vgxtN5GOAU_3NZUVaZSbLNodhAYb34l4sd1cA6-C3JgdQNMHHo_IBOHgdQaHBOHNJyvrgr7z31AqT_pe4z0a02b8sxRt4BOthZ1Yf1feb73MX1dZE0bZPiAzMLBmpYcFd7m1rjxfU5ayjNXoyr6asGEmLT5VwkeAio0r6iBipW08Ovpn88_m79Ij89BKtrSLcGQgjwTAFELE7cywU2wx4QxVaT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