ghidra icon indicating copy to clipboard operation
ghidra copied to clipboard

align comments with code in decompiler

Open goatshriek opened this issue 3 years ago • 1 comments

Add a configuration option for the decompiler to align comments with code instead of using the fixed indentation setting. See #575 for the original feature request.

goatshriek avatar Oct 04 '21 00:10 goatshriek

Just tested merging master with this and it still works as expected. Screenshots attached.

Current_Release is the behavior in 10.1.3.

Current_Release

Pull_Request is the behavior after running a merging master into this Pull Request and building it. Pull_Request

revolver-ocelot-saa avatar Apr 24 '22 17:04 revolver-ocelot-saa

Any E.T.A. on when/if this will be merged to release?

TorusHyperV avatar Jan 15 '23 17:01 TorusHyperV

Force-pushing a merge of this with the current master branch, based on feedback I've received on other pulls where this is preferred and fueled by wild optimism that it might get looked at soon.

goatshriek avatar Jan 16 '23 12:01 goatshriek

Does your current patch work on top of master? I assume you also need changes to ElementIds: https://github.com/jobermayr/ghidra-staging/blob/master/3472-align-comments-with-code-in-decompiler.patch

Hint: My version of ElementIds doesn't apply cleanly on top of master because I applied 1938 a few patches before.

jobermayr avatar Jan 16 '23 21:01 jobermayr

Thanks a ton for the heads-up on that, I didn't realize the mechanics of decompiler options were re-worked in such an extensive manner. It had indeed broken since the last check someone voluntarily performed.

The new ordinal-style numbering of elements combined with the sequential manner in which they've been assigned makes it virtually impossible to create a new ElementId in a clean manner. The new option is now jammed lamely at the end, but there's no way to insert it with the other options without making the numbers jump in a non-nonsensical way. Shifting the ordinals of every other element seems even less desirable. I've chosen one of the two equally ugly options I see, and await feedback from the Ghidra team on preferred alternate courses of action.

In the meantime, I tested this locally and it seems to work as expected, and the new tests pass once more.

goatshriek avatar Jan 17 '23 01:01 goatshriek