ddemangle #2

Merged
merged 7 commits into from Sep 5, 2011

Conversation

Projects
None yet
5 participants
Contributor

michelf commented Jun 23, 2011

Reads stdin, demangles mangled D symbols, send result to stdout. Useful to filter output from the linker.

Use KeepTerminator.yes here and replace writeln with write? That way you don't produce a spurious \n at end of file if it didn't have one.

Contributor

michelf commented Jul 5, 2011

Fixed: now using File.KeepTerminator.yes and write instead of writeln. Also removed tabs from ddemangle.d.

Member

klickverbot commented Jul 7, 2011

Does that handle symbols terminated by end-of-line correctly? I have been using this for quite some time now: https://gist.github.com/1069843 (with KeepTerminator.yes edited in right now having read Andrei's comment above).

Contributor

Trass3r commented Jul 7, 2011

Why does it check for ' ', '"' and ''' to end the search?
Anything that isn't alphanumeric or _ should terminate it, shouldn't it?
E.g. objdump gives stuff like <_D3std5stdio4File14__T5writeTAyaZ5writeMFAyaZv+0x7a>

Contributor

Trass3r commented Jul 7, 2011

btw, since I didn't know about this pull request before, I implemented yet another demangle tool which reads stdin char-wise, supports demangling names passed on the cmd line and --help.
I think one could also add that cmd line arguments are checked if they are filenames and then process that file instead.

https://github.com/Trass3r/tools/blob/master/dfilt/dfilt.d

Contributor

michelf commented Jul 8, 2011

I added a --help switch, and fixed scanning for end of symbol. I could obviously add more features (demangling names passed as arguments, or reading files), but I suggest we leave that to future pull requests.

stderr

stderr

Use DeMorgan to simplify: if (args.length != 2 || args[1] != "--help" && args[1] != "-h")

I'd rather not remove the braces, imho relying on && binding stronger than || is confusing for other people to read.

aren't you looking for isalnum here?

Once this is merged it'd be cool for rdmd to use it if it's available.

Owner

andralex commented Sep 2, 2011

ping?

Contributor

michelf commented Sep 2, 2011

I'll look at this this weekend. Been busy with other things lately.

Contributor

michelf commented Sep 5, 2011

Should be ready for merge now.

This is not about making code to my liking. I think the proposed changes improve the code and its behavior. If you don't think so, you are free to argue your point. Generally you shouldn't feel you're spending time on changes that don't add value.

Owner

michelf replied Sep 5, 2011

For one thing, I think you're right about writing help text to stderr, it was worth changing.

For the rest, I wouldn't have made those changes, but they don't bother me either. I'd be a waste of time to start arguing over such triviality.

@andralex andralex added a commit that referenced this pull request Sep 5, 2011

@andralex andralex Merge pull request #2 from michelf/master
Thanks!
72dc823

@andralex andralex merged commit 72dc823 into dlang:master Sep 5, 2011

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