exbin / bined-intellij-plugin

Hex viewer/editor plugin for JetBrains IntelliJ platform
https://bined.exbin.org/intellij-plugin
Apache License 2.0
59 stars 9 forks source link

GoLand wrong binary content #40

Open greenstatic opened 2 years ago

greenstatic commented 2 years ago

First, thank you for your awesome plugin, it really helps when debugging binary data.

I am using GoLand, Jetbrain's Intellij variant for the Go programming language.

It often happens when viewing "larger" (i.e. more than 10 bytes) byte slices, I get a subset of the "Show as Binary" view completely wrong. In the screenshot below the underlined content in the "Show as Binary" view does not correspond to the underlying bytes of a []byte slice.

Screen Shot 2022-07-05 at 5 05 37 PM

In this case it appears it replaces a "correct" byte with the series ef bf bd, although I'm not aware if this happens every single time when the plugin "fakes data".

This issue has occurred to me multiple times already with many different versions of GoLand.

Current setup:

Any idea what could cause this behaviour?

hajdam commented 2 years ago

Hi. Reason is that plugin supports only some types of debug fields. With JetBrains platform there are specific classes for different programming languages and as far as I know no general API is provided to access field value directly. I was able to implement some support for some languages, but even after many hours no luck for CLion and didn't even get to GoLand. As these IDE variants have got closed source, I was unable to identify any API to access value so far and to my knowledge there is no documentation about this either.

Implementation is visible here: https://github.com/exbin/bined-intellij-plugin/tree/master/src/org/exbin/bined/intellij/debug

In fallback mode plugin uses toString() method to at least access available String value without any knowledge if it contains binary data. Such value can have limited length and as it is UTF-8 text, values not convertible to single character are replaced with longer codes or character for "unknown unicode code" - which is what happens here.

greenstatic commented 2 years ago

Ahh, ofc, UTF-8 replacement character.

Thanks @hajdam for your detailed description. If I'll have any free time in the not so distant future, I'll try to help out.

hajdam commented 1 year ago

Released version 0.2.7 with added support for some debug fields extracting data from GUI tree - might be usable for some small arrays if you want to try it...

I still didn't find proper way to access values for GoLand thou...