GDB demangling

ANtlord antlord92 at gmail.com
Mon Dec 3 11:29:28 UTC 2018


Hello!

Short time ago I created a plugin that demangles D symbols in 
call stack. I'm gonna to add the code to upstream. After a little 
research mail lists and code of gdb I see a couple of mentions 
about demangling of D code. Also, I found threads in the forum 
about support of the demangling that was implemented by GDC team. 
But I see partially demangling when I'm debugging my favorite 
project DCD. Look at the call stack

#0  
_D7dsymbol6symbol7DSymbol__T17getFirstPartNamedTSQBvQBqQBmZQBfMNgFSQCn16string_interning14InternedStringZPNgSQEdQDyQDu (this=, name={
   data = "*constructor*"
})
         at dsymbol/src/dsymbol/symbol.d:234
#1  
dsymbol.conversion.first.FirstPass.visit(const(dparse.ast.StructBody)) (this=, structBody=)
         at dsymbol/src/dsymbol/conversion/first.d:401
#2  
_D6dparse3ast17StructDeclaration6acceptMxFCQBpQBl10ASTVisitorZv 
(this=, visitor=)
         at libdparse/src/dparse/ast.d-mixin-2757:2759
#3  
_D7dsymbol10conversion5first9FirstPass__T25visitAggregateDeclarationTxC6dparse3ast17StructDeclarationZQCjMFxQBmEQEg6symbol14CompletionKindZv (this=, kind=115 's', dec=)
         at dsymbol/src/dsymbol/conversion/first.d:809
#4  
dsymbol.conversion.first.FirstPass.visit(const(dparse.ast.StructDeclaration)) (this=, dec=)
         at dsymbol/src/dsymbol/conversion/first.d:184
#5  _D6dparse3ast11Declaration6acceptMxFCQBjQBf10ASTVisitorZv 
(this=, visitor=)
         at libdparse/src/dparse/ast.d:1244
#6  
dsymbol.conversion.first.FirstPass.visit(const(dparse.ast.Declaration)) (this=, dec=)
         at dsymbol/src/dsymbol/conversion/first.d:315
#7  _D6dparse3ast6Module6acceptMxFCQBdQz10ASTVisitorZv (this=, 
visitor=)
         at libdparse/src/dparse/ast.d-mixin-2196:2198
#8  
dsymbol.conversion.first.FirstPass.visit(const(dparse.ast.Module)) (this=, mod=)
         at dsymbol/src/dsymbol/conversion/first.d:338
#9  dsymbol.conversion.first.FirstPass.run() (this=) at 
dsymbol/src/dsymbol/conversion/first.d:91
#10 
_D7dsymbol11modulecache11ModuleCache11cacheModuleMFAyaZPSQCd6symbol7DSymbol (this=, location="/usr/include/dmd/phobos/etc/c/odbc/sqltypes.d")
         at dsymbol/src/dsymbol/modulecache.d:236
#11 
_D7dsymbol10conversion6second13resolveImportFPSQBt6symbol7DSymbolKS10containers12unrolledlist__T12UnrolledListTPSQEh11type_lookup10TypeLookupTS4stdx9allocator10mallocator10MallocatorVbi0Vmi64ZQDsKSQHn11modulecache11ModuleCacheZv (cache=, typeLookups=, acSymbol=)
         at dsymbol/src/dsymbol/conversion/second.d:142
#12 
_D7dsymbol10conversion6second10secondPassFPSQBq8semantic14SemanticSymbolPSQCu6scope_5ScopeKSQDm11modulecache11ModuleCacheZv (cache=, moduleScope=, currentSymbol=)
         at dsymbol/src/dsymbol/conversion/second.d:61
#13 
_D7dsymbol10conversion6second10secondPassFPSQBq8semantic14SemanticSymbolPSQCu6scope_5ScopeKSQDm11modulecache11ModuleCacheZv (cache=, moduleScope=, currentSymbol=)
         at dsymbol/src/dsymbol/conversion/second.d:77
#14 
_D7dsymbol11modulecache11ModuleCache11cacheModuleMFAyaZPSQCd6symbol7DSymbol (this=, location="/usr/include/dmd/phobos/etc/c/odbc/sql.d")
         at dsymbol/src/dsymbol/modulecache.d:238
#15 
_D7dsymbol10conversion6second13resolveImportFPSQBt6symbol7DSymbolKS10containers12unrolledlist__T12UnrolledListTPSQEh11type_lookup10TypeLookupTS4stdx9allocator10mallocator10MallocatorVbi0Vmi64ZQDsKSQHn11modulecache11ModuleCacheZv (cache=, typeLookups=, acSymbol=)
         at dsymbol/src/dsymbol/conversion/second.d:142
#16 
_D7dsymbol10conversion6second10secondPassFPSQBq8semantic14SemanticSymbolPSQCu6scope_5ScopeKSQDm11modulecache11ModuleCacheZv (cache=, moduleScope=, currentSymbol=)
         at dsymbol/src/dsymbol/conversion/second.d:61
#17 
_D7dsymbol10conversion6second10secondPassFPSQBq8semantic14SemanticSymbolPSQCu6scope_5ScopeKSQDm11modulecache11ModuleCacheZv (cache=, moduleScope=, currentSymbol=)
         at dsymbol/src/dsymbol/conversion/second.d:77
#18 
_D7dsymbol11modulecache11ModuleCache11cacheModuleMFAyaZPSQCd6symbol7DSymbol (this=, location="/usr/include/dmd/phobos/etc/c/odbc/sqlext.d")
         at dsymbol/src/dsymbol/modulecache.d:238
#19 
_D7dsymbol11modulecache11ModuleCache14addImportPathsMFxAAyaZ8scanFromMFxQqZv (this=, root="/usr/include/dmd/phobos/etc/c/odbc")
         at dsymbol/src/dsymbol/modulecache.d:123
#20 
_D7dsymbol11modulecache11ModuleCache14addImportPathsMFxAAyaZ8scanFromMFxQqZv (this=, root="/usr/include/dmd/phobos/etc/c")
         at dsymbol/src/dsymbol/modulecache.d:125
#21 
_D7dsymbol11modulecache11ModuleCache14addImportPathsMFxAAyaZ8scanFromMFxQqZv (this=, root="/usr/include/dmd/phobos/etc")
         at dsymbol/src/dsymbol/modulecache.d:125
#22 
_D7dsymbol11modulecache11ModuleCache14addImportPathsMFxAAyaZ8scanFromMFxQqZv (this=, root="/usr/include/dmd/phobos/")
         at dsymbol/src/dsymbol/modulecache.d:125
#23 
dsymbol.modulecache.ModuleCache.addImportPaths(const(immutable(char)[][])) (this=, paths={[0] = "/usr/include/dmd/phobos/"})
         at dsymbol/src/dsymbol/modulecache.d:129
#24 D main (args={[0] = "/endlessos/develop/DCD/bin/dcd-server"}) 
at src/dcd/server/main.d:167


You can see some readable messages like

#23 
dsymbol.modulecache.ModuleCache.addImportPaths(const(immutable(char)[][])) (this=, paths={[0] = "/usr/include/dmd/phobos/"})

and some unreadable

#22 
_D7dsymbol11modulecache11ModuleCache14addImportPathsMFxAAyaZ8scanFromMFxQqZv (this=, root="/usr/include/dmd/phobos/")

So please make me clear with the state of the demangling. Is it 
supported?


More information about the Digitalmars-d-debugger mailing list