GOTO skip modifier

Wishlists for new functionality and features.
Post Reply
MajsterTynek
Posts: 4
Joined: 15 Mar 2021 17:35

GOTO skip modifier

Post by MajsterTynek »

Data inspector has clickable `goto` command near integer types.
Could be possible to add a tickable option that when enabled,
would skip additionally the size of read data type?

(So it will behave like offset move happens at byte after it.)
I need this behavior to simplify reading packet dump,
where packet is preceded by length encoded as LEB128.
Maël
Site Admin
Posts: 1354
Joined: 12 Mar 2005 14:15

Re: GOTO skip modifier

Post by Maël »

Clicking "goto" on signed integers, will execute a relative jump (LEB128 is signed).
NewOffset = CurrentOffset + IntValue
Clicking "goto" on unsigned integers, will execute an absolute jump (ULEB128 is unsigned).
NewOffset = UIntValue

And you want this?
NewOffset = CurrentOffset + IntValue + sizeof(IntValue)
and
NewOffset = UIntValue + sizeof(UIntValue)
MajsterTynek
Posts: 4
Joined: 15 Mar 2021 17:35

Re: GOTO skip modifier

Post by MajsterTynek »

Maël wrote: 18 Mar 2021 20:55 And you want this?
NewOffset = CurrentOffset + IntValue + sizeof(IntValue)
and
NewOffset = UIntValue + sizeof(UIntValue)
`sizeof(LEB128)` and `sizeof(ULEB128)`,
which in both cases is variable number of bytes, not by some constant;
depending on encoded integer value in it, size may vary from 1 to several bytes

EDIT: for other datatypes with a fixed size, it should be as you said;
however, I don't know if it does make any sense for an absolute jump. 🤔
so I leave the definition of this open for you to define, as I care about relative one.
Maël
Site Admin
Posts: 1354
Joined: 12 Mar 2005 14:15

Re: GOTO skip modifier

Post by Maël »

`sizeof(LEB128)` and `sizeof(ULEB128)`,
which in both cases is variable number of bytes, not by some constant;
sizeof was meant to be dynamic, so 1, 2, 3 etc. bytes for (U)LEB128, just as other dynamic types like UTF-8 codepoints work
MajsterTynek
Posts: 4
Joined: 15 Mar 2021 17:35

Re: GOTO skip modifier

Post by MajsterTynek »

Yeah, that's the intended behavior for that modifier!
> read value, skip behind it, and then apply move :)

Though, as you mentioned absolute jump, I have no idea what to say,
because that would be just pointless, as the outcome would be the same. O_o
Maël
Site Admin
Posts: 1354
Joined: 12 Mar 2005 14:15

Re: GOTO skip modifier

Post by Maël »

I am not yet sure how to implement that in general (mostly GUI-wise), though potentially you could introduce a setting in the datainspector options, on how to handle pointers/gotos.

Or it may be it would only be available once the structure viewer is done, where you can parameterize how to handle pointers:
https://forum.mh-nexus.de/viewtopic.php?f=4&t=889

Regarding unsigned integers, I suppose you could configure if you want it to be a relative jump nonetheless.
MajsterTynek
Posts: 4
Joined: 15 Mar 2021 17:35

Re: GOTO skip modifier

Post by MajsterTynek »

I think a check box could be put with `hex base`
below data inspector and endianness selection.
Post Reply