2023-08-26 04:12:47 +02:00
|
|
|
NAME=pointer read
|
|
|
|
|
FILE=malloc://1024
|
|
|
|
|
CMDS=<<EOF
|
2026-02-19 23:13:18 +08:00
|
|
|
e asm.arch=arm
|
|
|
|
|
e asm.bits=64
|
|
|
|
|
e cfg.bigendian=false
|
2023-08-26 04:12:47 +02:00
|
|
|
wv8 0xdeadbeefdeadbeef
|
|
|
|
|
*0
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
*0 @e:asm.bits=32
|
2023-08-26 14:13:21 +08:00
|
|
|
*0 @e:asm.arch=x86,asm.bits=16
|
2023-08-26 04:12:47 +02:00
|
|
|
*0 @e:asm.arch=6502,asm.bits=8
|
Refactor pointer write command `*` to use the API (#3793)
* Add tests for pointer write command `*`
Some test cases override `asm.arch` for bitness compatibility reasons.
* Refactor pointer write command `*` to use the API
* Allow use of more general exprs as value for pointer write command `*` ##shell
* Instead of detecting when to write a value, and write a hexpair
otherwise, do the inverse: detect when to write a hexpair, and write a
value otherwise. This allows more general value exprs such as
variables, derefs, ...
* To enable this, add an option to `rz_hex_str_is_valid` so it can
reject a 0x-prefixed string (because 0x-prefixed strings should be
handled as values, not hexpairs, by the pointer write command)
* Add a test case to ensure a non-0x-prefixed value arg, that's not a
valid hexpair, now gets eval'ed as an expr by the pointer write
command (where previously it would throw an error)
2023-08-26 17:40:31 +02:00
|
|
|
*0+2 @e:asm.bits=32
|
2023-08-26 04:12:47 +02:00
|
|
|
EOF
|
|
|
|
|
EXPECT=<<EOF
|
|
|
|
|
0xdeadbeefdeadbeef
|
|
|
|
|
0xdeadbeefdeadbeef
|
|
|
|
|
0xdeadbeef
|
|
|
|
|
0xbeef
|
|
|
|
|
0xef
|
Refactor pointer write command `*` to use the API (#3793)
* Add tests for pointer write command `*`
Some test cases override `asm.arch` for bitness compatibility reasons.
* Refactor pointer write command `*` to use the API
* Allow use of more general exprs as value for pointer write command `*` ##shell
* Instead of detecting when to write a value, and write a hexpair
otherwise, do the inverse: detect when to write a hexpair, and write a
value otherwise. This allows more general value exprs such as
variables, derefs, ...
* To enable this, add an option to `rz_hex_str_is_valid` so it can
reject a 0x-prefixed string (because 0x-prefixed strings should be
handled as values, not hexpairs, by the pointer write command)
* Add a test case to ensure a non-0x-prefixed value arg, that's not a
valid hexpair, now gets eval'ed as an expr by the pointer write
command (where previously it would throw an error)
2023-08-26 17:40:31 +02:00
|
|
|
0xbeefdead
|
|
|
|
|
EOF
|
|
|
|
|
RUN
|
|
|
|
|
|
|
|
|
|
NAME=pointer write value
|
|
|
|
|
FILE=malloc://1024
|
|
|
|
|
CMDS=<<EOF
|
2026-02-19 23:13:18 +08:00
|
|
|
e asm.arch=arm
|
|
|
|
|
e asm.bits=64
|
|
|
|
|
e cfg.bigendian=false
|
Refactor pointer write command `*` to use the API (#3793)
* Add tests for pointer write command `*`
Some test cases override `asm.arch` for bitness compatibility reasons.
* Refactor pointer write command `*` to use the API
* Allow use of more general exprs as value for pointer write command `*` ##shell
* Instead of detecting when to write a value, and write a hexpair
otherwise, do the inverse: detect when to write a hexpair, and write a
value otherwise. This allows more general value exprs such as
variables, derefs, ...
* To enable this, add an option to `rz_hex_str_is_valid` so it can
reject a 0x-prefixed string (because 0x-prefixed strings should be
handled as values, not hexpairs, by the pointer write command)
* Add a test case to ensure a non-0x-prefixed value arg, that's not a
valid hexpair, now gets eval'ed as an expr by the pointer write
command (where previously it would throw an error)
2023-08-26 17:40:31 +02:00
|
|
|
wx ffffffffffffffff
|
|
|
|
|
*0=0xdeadbeefdeadbeef
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
wx ffffffffffffffff
|
|
|
|
|
*0=0xdeadbeefdeadbeef @e:asm.bits=64
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
wx ffffffffffffffff
|
|
|
|
|
*0=0xdeadbeef @e:asm.bits=32
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
wx ffffffffffffffff
|
|
|
|
|
*0=0xbeef @e:asm.arch=x86,asm.bits=16
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
wx ffffffffffffffff
|
|
|
|
|
*0=0xef @e:asm.arch=6502,asm.bits=8
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
wx ffffffffffffffff
|
|
|
|
|
*0+2=0xbeefdea0+0xd @e:asm.bits=32
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
wx efbeaddeffffffff
|
|
|
|
|
*0+4=[0] @e:asm.bits=64
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
EOF
|
|
|
|
|
EXPECT=<<EOF
|
|
|
|
|
0xdeadbeefdeadbeef
|
|
|
|
|
0xdeadbeefdeadbeef
|
|
|
|
|
0xffffffffdeadbeef
|
|
|
|
|
0xffffffffffffbeef
|
|
|
|
|
0xffffffffffffffef
|
|
|
|
|
0xffffbeefdeadffff
|
|
|
|
|
0xdeadbeefdeadbeef
|
|
|
|
|
EOF
|
|
|
|
|
RUN
|
|
|
|
|
|
|
|
|
|
NAME=pointer write hex
|
|
|
|
|
FILE=malloc://1024
|
|
|
|
|
CMDS=<<EOF
|
2026-02-19 23:13:18 +08:00
|
|
|
e asm.arch=arm
|
|
|
|
|
e cfg.bigendian=false
|
Refactor pointer write command `*` to use the API (#3793)
* Add tests for pointer write command `*`
Some test cases override `asm.arch` for bitness compatibility reasons.
* Refactor pointer write command `*` to use the API
* Allow use of more general exprs as value for pointer write command `*` ##shell
* Instead of detecting when to write a value, and write a hexpair
otherwise, do the inverse: detect when to write a hexpair, and write a
value otherwise. This allows more general value exprs such as
variables, derefs, ...
* To enable this, add an option to `rz_hex_str_is_valid` so it can
reject a 0x-prefixed string (because 0x-prefixed strings should be
handled as values, not hexpairs, by the pointer write command)
* Add a test case to ensure a non-0x-prefixed value arg, that's not a
valid hexpair, now gets eval'ed as an expr by the pointer write
command (where previously it would throw an error)
2023-08-26 17:40:31 +02:00
|
|
|
wx ffffffffffffffff
|
|
|
|
|
*0+2=addeefbe
|
|
|
|
|
*0 @e:asm.bits=64
|
|
|
|
|
EOF
|
|
|
|
|
EXPECT=<<EOF
|
|
|
|
|
0xffffbeefdeadffff
|
2023-08-26 04:12:47 +02:00
|
|
|
EOF
|
|
|
|
|
RUN
|