Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

px to rzshell #2853

Merged
merged 41 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ead507c
convert `px[ dDhHwWqQol]` to new shell
imbillow Jul 16, 2022
4a5da9e
fix
imbillow Jul 17, 2022
307b44a
fix
imbillow Jul 17, 2022
4842764
fix
imbillow Jul 17, 2022
5dd8bff
expose APIs
imbillow Jul 17, 2022
d2380dc
remove old
imbillow Jul 17, 2022
71d8dfe
fix
imbillow Jul 18, 2022
ae03930
fix
imbillow Jul 18, 2022
51043ce
fix
imbillow Jul 18, 2022
b4e0e23
fix
imbillow Jul 18, 2022
339c970
fix
imbillow Jul 18, 2022
c9129be
doxygen
imbillow Jul 19, 2022
d8d05d3
fix
imbillow Jul 19, 2022
cfe1eb4
fix
imbillow Jul 20, 2022
a684dc6
`pxd` -> `pxd[ hwq]`
imbillow Jul 20, 2022
d059c9f
`char*`
imbillow Jul 20, 2022
a6e1114
fix
imbillow Jul 20, 2022
83baf1b
unroll `sb_print*`
imbillow Jul 21, 2022
53cdd52
fix
imbillow Jul 21, 2022
4beece1
fix
imbillow Jul 21, 2022
ee3db1a
dox
imbillow Jul 21, 2022
43e6fd0
notion
imbillow Jul 21, 2022
def4f3f
Update librz/core/cmd_descs/cmd_print.yaml
imbillow Jul 23, 2022
0e6548c
Update librz/core/cmd_descs/cmd_print.yaml
imbillow Jul 23, 2022
21f50c5
Apply suggestions from code review
imbillow Jul 23, 2022
b99693b
Apply suggestions from code review
imbillow Jul 23, 2022
e6a9c76
unroll macro
imbillow Jul 23, 2022
0290640
revert style change
imbillow Jul 23, 2022
e751299
doxygen
imbillow Jul 23, 2022
95b13c7
fix
imbillow Jul 23, 2022
ce80bb3
fix
imbillow Jul 23, 2022
7158457
fix
imbillow Jul 23, 2022
2346ca8
fix
imbillow Jul 23, 2022
57db10b
Merge branch 'expose_api_p' into rzshell_px
imbillow Jul 29, 2022
43bfb84
fix
imbillow Jul 29, 2022
071bbca
fix
imbillow Jul 29, 2022
439a26d
`pxc`
imbillow Jul 29, 2022
ac48c7f
port `px` to rzshell
imbillow Jul 29, 2022
e4ace76
apply suggestions
imbillow Jul 30, 2022
b93cf62
fix
imbillow Aug 3, 2022
a1bddeb
Merge branch 'dev' into rzshell_px
imbillow Aug 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,078 changes: 442 additions & 636 deletions librz/core/cmd/cmd_print.c

Large diffs are not rendered by default.

560 changes: 560 additions & 0 deletions librz/core/cmd_descs/cmd_descs.c

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions librz/core/cmd_descs/cmd_descs.h
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,36 @@ RZ_IPI RzCmdStatus rz_print_utf16le_handler(RzCore *core, int argc, const char *
RZ_IPI RzCmdStatus rz_print_utf32le_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
RZ_IPI RzCmdStatus rz_print_utf16be_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
RZ_IPI RzCmdStatus rz_print_utf32be_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
RZ_IPI RzCmdStatus rz_print_hexdump_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_annotated_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_op_analysis_color_map_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_bits_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexdump_comments_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexdump_signed_integer_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_signed_integer2_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_signed_integer4_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_signed_integer8_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_emoji_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexdump_function_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexdump_hexii_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexword_references_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexword_references_1_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexword_references_2_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexword_references_4_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexword_references_8_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_sparse_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_delta_pointer_table_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_hexless_bytes_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexdump_hexless_words_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexdump_hexpair_bytes_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexdump_hex2_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_hex2l_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_hex4_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_hex4l_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_hex8_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_hex8l_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_print_hexdump_oct_handler(RzCore *core, int argc, const char **argv);
RZ_IPI RzCmdStatus rz_print_hexdump_n_lines_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
RZ_IPI RzCmdStatus rz_cmd_base64_encode_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
RZ_IPI RzCmdStatus rz_cmd_base64_decode_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
RZ_IPI int rz_cmd_print(void *data, const char *input);
Expand Down
304 changes: 304 additions & 0 deletions librz/core/cmd_descs/cmd_print.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,310 @@ commands:
- name: type
type: RZ_CMD_ARG_TYPE_NUM
optional: true
- name: px
summary: Show hexdump
subcommands:
- name: px
summary: show hexdump
cname: print_hexdump
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxa
summary: show annotated hexdump
cname: print_hexdump_annotated
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxA
summary: show op analysis color map
cname: print_op_analysis_color_map
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_LONG
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxb
summary: dump bits in hexdump form
cname: print_hexdump_bits
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxc
summary: show hexdump with comments
cname: print_hexdump_comments
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxd
summary: show signed integer dump
subcommands:
- name: pxd
summary: show 1-byte integer dump
cname: print_hexdump_signed_integer
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxdh
summary: show 2-bytes integer dump
cname: print_hexdump_signed_integer2
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxdw
summary: show 4-bytes integer dump
cname: print_hexdump_signed_integer4
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxdq
summary: show 8-bytes integer dump
cname: print_hexdump_signed_integer8
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxe
summary: emoji hexdump! :)
cname: print_hexdump_emoji
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxf
summary: show hexdump of current function
cname: print_hexdump_function
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxi
summary: HexII compact binary representation
cname: print_hexdump_hexii
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxr
summary: show hexword references
subcommands:
- name: pxr
summary: show hexword references
cname: print_hexword_references
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_QUIET
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
- RZ_OUTPUT_MODE_TABLE
- RZ_OUTPUT_MODE_RIZIN
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxr1
summary: show hexword references
cname: print_hexword_references_1
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_QUIET
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
- RZ_OUTPUT_MODE_TABLE
- RZ_OUTPUT_MODE_RIZIN
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxr2
summary: show hexword references with hexdump
cname: print_hexword_references_2
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_QUIET
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
- RZ_OUTPUT_MODE_TABLE
- RZ_OUTPUT_MODE_RIZIN
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxr4
summary: show hexword references with hexdump
cname: print_hexword_references_4
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_QUIET
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
- RZ_OUTPUT_MODE_TABLE
- RZ_OUTPUT_MODE_RIZIN
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxr8
summary: show hexword references with hexdump
cname: print_hexword_references_8
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_QUIET
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
- RZ_OUTPUT_MODE_TABLE
- RZ_OUTPUT_MODE_RIZIN
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxs
summary: show hexadecimal in sparse mode
cname: print_hexdump_sparse
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxt
summary: show delta pointer table in rizin commands
cname: print_delta_pointer_table
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args: []
- name: pxx
summary: show <N> bytes of hex-less hexdump
cname: print_hexdump_hexless_bytes
args: []
- name: pxX
summary: show <N> words of hex-less hexdump
cname: print_hexdump_hexless_words
args:
- name: N
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: px0
summary: 8bit hexpair list of bytes until zero byte
cname: print_hexdump_hexpair_bytes
args:
- name: N
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxh
summary: show 2-bytes hexadecimal integers dump
cname: print_hexdump_hex2
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxH
summary: show 2-bytes hexadecimal integers dump, one per line
cname: print_hexdump_hex2l
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxw
summary: show 4-bytes hexadecimal integers dump
cname: print_hexdump_hex4
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxW
summary: show 4-bytes hexadecimal integers dump, one per line
cname: print_hexdump_hex4l
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxq
summary: show 8-bytes hexadecimal integers dump
cname: print_hexdump_hex8
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxQ
summary: show 8-bytes hexadecimal integers dump, one per line
cname: print_hexdump_hex8l
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxo
summary: show 1-byte octal integers dump
cname: print_hexdump_oct
args:
- name: len
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: pxl
summary: display <N> lines of hexdump
cname: print_hexdump_n_lines
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: N
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: p6
summary: Base64 decoding/encoding
subcommands:
Expand Down
6 changes: 6 additions & 0 deletions librz/core/core_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ RZ_IPI void rz_core_asm_bb_middle(RZ_NONNULL RzCore *core, ut64 at, RZ_INOUT RZ_
RZ_IPI bool rz_core_handle_backwards_disasm(RZ_NONNULL RzCore *core,
RZ_NONNULL RZ_INOUT int *pn_opcodes, RZ_NONNULL RZ_INOUT int *pn_bytes);

/* cprint.c */
RZ_IPI bool rz_core_print_hexdump_diff(RZ_NONNULL RzCore *core, ut64 aa, ut64 ba, ut64 len);
RZ_IPI bool rz_core_print_dump(RZ_NONNULL RzCore *core, RzOutputMode mode, ut64 addr, ut8 n, int len, RzCorePrintFormatType format);
RZ_IPI bool rz_core_print_hexdump_or_hexdiff(RZ_NONNULL RzCore *core, RzOutputMode mode, ut64 addr, int len, bool use_comments);
RZ_IPI bool rz_core_print_hexdump_byline(RZ_NONNULL RzCore *core, bool hex_offset, ut64 addr, int len, ut8 size);

/* cmd_seek.c */
RZ_IPI bool rz_core_seek_to_register(RzCore *core, const char *input, bool is_silent);
RZ_IPI int rz_core_seek_opcode_forward(RzCore *core, int n, bool silent);
Expand Down
Loading