gdb icon indicating copy to clipboard operation
gdb copied to clipboard

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

Open rainers opened this issue 8 years ago • 5 comments

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

rainers avatar Apr 17 '17 13:04 rainers

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.

rainers avatar Apr 17 '17 19:04 rainers

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.

ibuclaw avatar Apr 18 '17 12:04 ibuclaw

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 avatar Apr 18 '17 18:04 rainers

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

rainers avatar Apr 19 '17 07:04 rainers

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

ibuclaw avatar May 17 '20 10:05 ibuclaw