Skip to content

tweak D demangling to be more in lline with core.demangle#6

Open
rainers wants to merge 2 commits intoibuclaw:dlangfrom
rainers:tweak_demangle
Open

tweak D demangling to be more in lline with core.demangle#6
rainers wants to merge 2 commits intoibuclaw:dlangfrom
rainers:tweak_demangle

Conversation

@rainers
Copy link

@rainers rainers commented Apr 17, 2017

  • fix delegate/function syntax
  • show function attributes with DMGL_VERBOSE
  • fix memory leak (mods)

@rainers
Copy link
Author

rainers commented Apr 17, 2017

Wouldn't you want attributes to be postfixed, and not prefixed?

Yes, that would probably be nicer, but prefixed is compatible with core.demangle.

Also, I've just noticed that my addition of options should probably strip off DMGL_TYPES in the recursive calls. Otherwise you'll get int int some.symbol(some.other.symbol)

True, the return/variable types should be stripped in symbol references.

@ibuclaw
Copy link
Owner

ibuclaw commented Apr 18, 2017

Yes, that would probably be nicer, but prefixed is compatible with core.demangle.

But doesn't make sense for symbol search in say gdb. Though I can have another look at what flags they use, as well as other objdump/nm utilities. But I'd prefer append over prepend in the output any day.

@rainers
Copy link
Author

rainers commented Apr 18, 2017

But doesn't make sense for symbol search in say gdb.

I guess it doesn't make much sense to search the "verbose" symbols to begin with.

Though I can have another look at what flags they use, as well as other objdump/nm utilities. But I'd prefer append over prepend in the output any day.

Unfortuately, even the compiler prefers to print the attributes first:

void fn() nothrow;
pragma(msg, typeof(fn).stringof); // nothrow void()
pragma(msg, typeof(&fn).stringof); // void function() nothrow

Maybe we can add a "private" flag to the options? Nevertheless I'll change the default to append...

BTW: from demangle.h it seems that you should use DMGL_RET_DROP instead of DMGL_TYPES to drop the return type.

@rainers
Copy link
Author

rainers commented Apr 19, 2017

Updated to append the attributes, but the calling convention still has to be prepended.

@ibuclaw
Copy link
Owner

ibuclaw commented May 17, 2020

I rebased this on top of dlang, just to see how it looks like with the new info struct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants