radareorg / radare2-r2pipe

Access radare2 via pipe from any programming language!
388 stars 99 forks source link

Improve cmdj and cmdjf to allow a user defined struct as argument #145

Closed buzzer-re closed 2 years ago

buzzer-re commented 2 years ago

Checklist

Description cmdj and cmdj returns an interface, a better approach is to let the developer sent an already known struct type and works just like the json.Unmarshal method.

inst := Instruction{}
r2.Cmdjf("pdj %d @ %d ~{0}", &inst, numOpcodes, address)

Where the struct Instruction is an already built struct with the required fields from the json response.