[llvm] [RFC] Emit dwarf data for signature-changed or new functions (PR #157349)

Vladislav Dzhidzhoev via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 04:49:33 PDT 2025


dzhidzhoev wrote:

> @dzhidzhoev @OCHyams I tried another approach. Basically, I will add a 'declaration' for the func whose signature changed. The 'declaration' will have the source level signature and the signature-changed func will have _real_ signature.
> 
> See my github branch: [main...yonghong-song:llvm-project:dwarf-signature-change/dwarf-signature-change-extra-unit-v6-1](https://github.com/llvm/llvm-project/compare/main...yonghong-song:llvm-project:dwarf-signature-change/dwarf-signature-change-extra-unit-v6-1)
> 
> esp. this commit: [a8ff54b](https://github.com/llvm/llvm-project/commit/a8ff54bca542d2dcd0e269a77c656052c87fec40)
> 
> This approach still has the difference with lldb. For example, for my previous example without lto:
> 
> ```
> So comparing this backtrace:
>     * frame #0: 0x0000555555555161 ex2`inc(x=41) at ex2.c:5:18
>       frame https://github.com/llvm/llvm-project/pull/1: 0x0000555555555146 ex2`do_work(n=41) at ex2.c:11:13 [inlined]
>       frame https://github.com/llvm/llvm-project/pull/2: 0x0000555555555140 ex2`main at ex2.c:17:12
>       frame https://github.com/llvm/llvm-project/pull/3: 0x00007ffff7c2a610 libc.so.6`__libc_start_call_main + 128
>       frame https://github.com/llvm/llvm-project/pull/4: 0x00007ffff7c2a6c0 libc.so.6`__libc_start_main@@GLIBC_2.34 + 128
>       frame https://github.com/llvm/llvm-project/pull/5: 0x0000555555555075 ex2`_start + 37
> vs. the same backtrace without this pull request:
>     * frame #0: 0x0000555555555161 ex2`inc(x=41, y=<unavailable>) at ex2.c:5:18
>       frame https://github.com/llvm/llvm-project/pull/1: 0x0000555555555146 ex2`do_work(n=41) at ex2.c:11:13 [inlined]
>       frame https://github.com/llvm/llvm-project/pull/2: 0x0000555555555140 ex2`main at ex2.c:17:12
>       frame https://github.com/llvm/llvm-project/pull/3: 0x00007ffff7c2a610 libc.so.6`__libc_start_call_main + 128
>       frame https://github.com/llvm/llvm-project/pull/4: 0x00007ffff7c2a6c0 libc.so.6`__libc_start_main@@GLIBC_2.34 + 128
>       frame https://github.com/llvm/llvm-project/pull/5: 0x0000555555555075 ex2`_start + 37
> ```

Let's consider the case if we have two functions in the source code:
```c++
int foo(int x, int y) { ... }
int foo(int x) { ... }
```

And let's assume that the second argument of `foo(int, int)` is optimized out (so that the second argument will be removed from definition DISubprogram's arguments).

If we try to execute `print foo(5)` in debugger, will debugger correctly resolve the overloaded functions call?

https://github.com/llvm/llvm-project/pull/157349


More information about the llvm-commits mailing list