binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

Comments on HLIL are frequently not placed on the correct line

Open plafosse opened this issue 4 years ago • 5 comments

As function comments are only placed on addresses HLIL comments frequently are placed on an untended instruction. To solve this we would likely need to store additional data in addition to the address in order to find the proper location to place comments.

This issue is partially mitigated by providing better HLIL address mappings.

plafosse avatar Oct 20 '21 13:10 plafosse

As a workaround, it would be useful to at least be able to force comments to be displayed on a certain HLIL statement - at the moment, it's not uncommon to encounter e.g. a branch of an if-elseif-else on which no comments whatsoever can be placed in HLIL (they always show up somewhere else), which is quite frustrating.

ntheis-anvilsecure avatar Oct 20 '21 18:10 ntheis-anvilsecure

As a workaround, it would be useful to at least be able to force comments to be displayed on a certain HLIL statement - at the moment, it's not uncommon to encounter e.g. a branch of an if-elseif-else on which no comments whatsoever can be placed in HLIL (they always show up somewhere else), which is quite frustrating.

Agree with this- things get especially bad with switch statements, placing all comments at the top of the switch

mattraneri avatar Dec 21 '21 23:12 mattraneri

This has been improved as of 2.5.3158-dev, see https://github.com/Vector35/binaryninja-api/issues/2792#issuecomment-1006148094. There is still the problem of duplicate addresses leading to duplicate comments in HLIL, which is what this issue tracks.

CouleeApps avatar Jan 05 '22 23:01 CouleeApps

Potentially related:

  • https://github.com/Vector35/binaryninja-api/issues/708
  • https://github.com/Vector35/binaryninja-api/issues/4464

0xdevalias avatar Jun 03 '24 06:06 0xdevalias

Potentially related to this: https://github.com/Vector35/binaryninja-api/issues/3754

plafosse avatar Oct 10 '24 18:10 plafosse

Comment placement code has been substantially overhauled leading to this happening far less. Expressions trees on every line of IL are walked and the original addresses checked for comments, allowing multiple addresses to contribute comments to the same line. This helps where folding has occurred.

This should minimize comments being 'lost' as movement up through the IL happens.

rssor avatar Nov 06 '24 18:11 rssor