Fix nim-gdb.py script (#24824)

Script wasn't working on my machine with GDB 16.2
Main issues
 - `gdb.types` wasn't imported, leading to import error on initial load
 - dollar function didn't work with the new mangling scheme

Fixes them, also updates the test script to work with some new mangling
changes.

Test evidence

![image](https://github.com/user-attachments/assets/450b020f-1665-4ed2-9073-d02537150914)
This commit is contained in:
Jake Leahy
2025-03-29 23:28:28 +11:00
committed by GitHub
parent ecdcffed4b
commit e0a4876981
2 changed files with 8 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import gdb
import gdb.types
import re
import sys
import traceback
@@ -151,8 +152,8 @@ class DollarPrintFunction (gdb.Function):
"Nim's equivalent of $ operator as a gdb function, available in expressions `print $dollar(myvalue)"
dollar_functions = re.findall(
r'(?:NimStringDesc \*|NimStringV2)\s?(dollar__[A-z0-9_]+?)\(([^,)]*)\);',
gdb.execute("info functions dollar__", True, True)
r'(?:NimStringDesc \*|NimStringV2)\s?([A-z0-9_]+?dollar_[A-z0-9_]+?)\(([^,)]*)\);',
gdb.execute("info functions dollar_", True, True)
)
def __init__ (self):