Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 11, 2010 [Issue 4852] New: core.demangle cannot demangle functions with class/struct return types | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4852 Summary: core.demangle cannot demangle functions with class/struct return types Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: patch Severity: normal Priority: P2 Component: druntime AssignedTo: sean@invisibleduck.org ReportedBy: r.sagitario@gmx.de --- Comment #0 from Rainer Schuetze <r.sagitario@gmx.de> 2010-09-11 05:05:20 PDT --- There are similar bug reports regarding std.demangle, but as it is reimplemented in core.demangle, I've created this new bug report. for example: _D3dmd6Parser6Parser15parsePrimaryExpMFZC3dmd10Expression10Expression if demangled to dmd dmd.Parser.Parser.parsePrimaryExp() but it should be dmd.Expression.Expression dmd.Parser.Parser.parsePrimaryExp() This is caused by parseLName() not continue reading after eating the first identifier of the fully qualified class name. Index: demangle.d =================================================================== --- demangle.d (revision 390) +++ demangle.d (working copy) @@ -378,20 +378,26 @@ debug(trace) printf( "parseLName+\n" ); debug(trace) scope(success) printf( "parseLName-\n" ); - auto n = decodeNumber(); + while( true ) + { + auto n = decodeNumber(); - if( !n || n > buf.length || n > buf.length - pos ) - error( "LName must be at least 1 character" ); - if( '_' != tok() && !isAlpha( tok() ) ) - error( "Invalid character in LName" ); - foreach( e; buf[pos + 1 .. pos + n] ) - { - if( '_' != e && !isAlpha( e ) && !isDigit( e ) ) + if( !n || n > buf.length || n > buf.length - pos ) + error( "LName must be at least 1 character" ); + if( '_' != tok() && !isAlpha( tok() ) ) error( "Invalid character in LName" ); + foreach( e; buf[pos + 1 .. pos + n] ) + { + if( '_' != e && !isAlpha( e ) && !isDigit( e ) ) + error( "Invalid character in LName" ); + } + + put( buf[pos .. pos + n] ); + pos += n; + if( !isDigit( tok() ) ) + break; + put( "." ); } - - put( buf[pos .. pos + n] ); - pos += n; } /* -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 25, 2010 [Issue 4852] core.demangle cannot demangle functions with class/struct return types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=4852 --- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2010-09-25 00:03:59 PDT --- Created an attachment (id=774) corrected patch including some additions Please ignore the previous patch, it is flawed and breaks demangling other symbols. What is actually necessary is to call parseQualifiedName instead of parseLName to get the full qualified name, but this involves a call to a function declared later which does not work with local functions, so I placed the local functions into a struct. Included is also a bug fix decoding string literals in template arguments (line 1064). This allows to reenable the 2 failing unittest symbols. I'm proposing to add an argument to demangle() whether the full type is requested or just the qualified name. I've added a function "decodeDmdString" to decompress symbols that are emitted compressed by dmd on windows. I think it is very much related to demangling, so it should have its place in this module, but a better name would be much appreciated. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 25, 2010 [Issue 4852] core.demangle cannot demangle functions with class/struct return types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=4852 Rainer Schuetze <r.sagitario@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #774|application/octet-stream |text/plain mime type| | Attachment #774 is|0 |1 patch| | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 02, 2010 [Issue 4852] core.demangle cannot demangle functions with class/struct return types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=4852 Sean Kelly <sean@invisibleduck.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #2 from Sean Kelly <sean@invisibleduck.org> 2010-11-02 15:46:10 PDT --- I've applied the patch and made a few tweaks. Still not sure exactly how I want to expose the AddType feature though. For now I just wanted to get the patch in. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 15, 2011 [Issue 4852] core.demangle cannot demangle functions with class/struct return types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=4852 --- Comment #3 from Rainer Schuetze <r.sagitario@gmx.de> 2011-02-14 23:28:17 PST --- In my version of druntime I've exposed a version with AddType support by adding a function like this: char[] demangle( const(char)[] buf, bool addType_, char[] dst = null ) { auto d = Demangle(buf, addType_ ? Demangle.AddType.yes : Demangle.AddType.no, dst); return d(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation