From f20e6ef901469786cdab5e5dbef173607b38be9a Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Thu, 27 Feb 2025 23:45:04 +0800 Subject: [PATCH] fixes #24705; encode `static parameters` into function names for debugging (#24707) fixes #24705 ```nim proc xxx(v: static int) = echo v xxx(10) xxx(20) ``` They are mangled as `_ZN14titaniummangle7xxx_s10E` and `_ZN14titaniummangle7xxx_s20E` with `--debugger:native`. Static parameters are prefixed with `_s` to distinguish simple cases like `xxx(10, 15)` and `xxx(101, 5)` if `xxx` supports two `static[int]` parameters (cherry picked from commit c452275e2942c64d871c20ab29e14497b4340173) --- compiler/ccgtypes.nim | 8 ++++++-- compiler/ccgutils.nim | 21 +++++++++++++-------- tests/codegen/titaniummangle.nim | 9 ++++++++- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 7cb6f1eebd..7e0ae74d02 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -57,11 +57,15 @@ proc mangleField(m: BModule; name: PIdent): string = proc mangleProc(m: BModule; s: PSym; makeUnique: bool): string = result = "_Z" # Common prefix in Itanium ABI - result.add encodeSym(m, s, makeUnique) + var params = "" + var staticLists = "" if s.typ.len > 1: #we dont care about the return param for i in 1..