matt-kempster / m2c

A MIPS and PowerPC decompiler.
GNU General Public License v3.0
403 stars 49 forks source link

Limit output lines to 80 characters #25

Open matt-kempster opened 5 years ago

matt-kempster commented 5 years ago

I have two unrelated complaints about the current state of output:

  1. Lines in the final C code should be limited to 80 characters wherever possible. Python's textwrap library will likely be useful here, although we may have to be intelligent about wrapping things like function calls and assignment statements.

  2. There is too much noise in stdout when you just want to decompile one function. All of the registers, node information, etc should be output only when desired (e.g. for debugging) or when an error is detected. Also, node info should probably be output not in DFS-order, but in linear order (with the original MIPS).

simonlindholm commented 5 years ago

I haven't found 1 to be a problem, but 2 I definitely agree with. I've been using --no-debug --no-node-comments ever since I added those flags.

matt-kempster commented 5 years ago

First, we should just flip --no-debug --no-node-comments, and maybe combine them into one flag too. Then, we should work on improving the debug workflow - when a particular node fails, output a comment with a // Failed node comment and some partial contents, as well as outputting relevant (?!) register values.

For 1, btw, this is just something we should do eventually. It's not a problem almost at all, but eventually if this thing is gonna output viable plug-and-play C code, it should conform to style standards.