Commit Graph

72 Commits

Author SHA1 Message Date
pancake
a79add6dff
Update sdb to remove double include paths ##build
* Updated pkg-config paths
2022-11-19 01:05:18 +01:00
pancake
3feb8a514c Remove some more unused and deprecated RCmd APIs 2022-09-15 16:36:10 +02:00
pancake
61e2da5acf
Remove unused apis in cmd and disable related unit tests 2022-09-14 08:46:06 +02:00
Lazula
c496680619 Optimize alias iteration to linear time and improve alias help 2022-06-03 20:45:01 +02:00
pancake
89ecb9fe74 Fix serializing macros (* using ; instead of , ##projects
* This syntax changed 3 years ago, but it was incorrectly done
2022-05-05 10:05:07 +02:00
Lazula
25fc71570c Overhaul alias system
Aliases now use a hashtable. Aliases are now either commands or data.
Data aliases may be strings or raw bytes.

* Expand alias API
* Remove remote aliases - remote commands can still be aliased normally
* Update alias help text
* Fix an alias test and add new tests
* Add r_str_escape_raw() for null-safe escaping of unprintable characters
* Remove command to print alias without newline
* Fix dif command opening files as strings
2021-10-04 09:30:37 +02:00
pancake
50580d3e87 Move RCorePlugin from r_cmd.h to r_core.h 2021-03-17 11:50:09 +01:00
pancake
89f6c6e1f1
Fix many ASAN issues, from uaf to memory leaks and some boolification (#18048) 2020-12-20 23:37:45 +01:00
pancake
282332bee5
Cleanup some code (#18035) 2020-12-14 10:09:48 +01:00
pancake
7df28e1fb2
Implement the comma command to manage user-defined tables ##util (#17702)
* Import export in CSV and R2 formats
* Export in JSON, ascii-art, columns, r2, ..
* For example: aaa;aflt>$a;,.$a,/size/sum
2020-12-09 03:39:49 +01:00
Riccardo Schirone
72baf0da5c
Split GROUP RCmdDesc and regular ones ##newshell (#17726)
* Convert R_CMD_DESC_TYPE_GROUP to INNER

* Avoid confusing "group_" prefixes by splitting cmddesc ##newshell

Create "group" command descriptor and give them their own help, to avoid
dupping fields such as group_summary, group_args_str, etc. By having a
separate help structure for the grouping node we make the cmd_api code
easier because it doesn't need to distinguish between
group_summary/summary, group_args_str/args_str, etc. and we avoid few
bytes for each command descriptor help structure, since most of them
did not use group_* fields.

* Other simplification in cmd_api due to split GROUP/exec cb.

* Handle R_CMD_DESC_TYPE_GROUP in r_cmd_call_parsed_args
2020-09-30 13:38:30 +08:00
Riccardo Schirone
9b59074787
Automatically group sub-commands ##newshell (#17663)
* Add GROUP RCmdDesc type and fix where the args_str is shown
* Adjust color of `[?]`
* Differentiate between cmd<?> and cmd[?]
<?> when cmd is not valid by itself
[?] when cmd is valid but there are also other sub-commands available
* Fix usage for commands like `w` that are both commands and groups
* Do not automatically switch to detail=2 for leaf commands
* Fix test due to change in `?`/`??` behaviour
2020-09-24 17:50:52 +02:00
Riccardo Schirone
75a80741ee
Make root a argv RCmdDesc ##newshell (#17326) 2020-09-15 15:27:10 +02:00
Riccardo Schirone
652df7f497
Add r_cmd_desc_remove API to unregister commands (#17349) 2020-07-24 14:23:56 +08:00
Riccardo Schirone
2ffa790e0a
Generate help automatically ##newshell (#16782)
* Add additional RCmdStatuses
* ?? should be a cmd_identifier, not help_command
2020-06-17 21:29:23 +02:00
Riccardo Schirone
56f88a0e20
Remove INNER nodes and merge inner node with the command with same name (#16784)
* Remove INNER nodes and merge inner node with the command with same name
* Add test
2020-05-11 10:55:49 +02:00
Riccardo Schirone
03a5c4d3f5
Remove RCoreCmdStatus and just use RCmdStatus (#16774)
* Remove RCoreCmdStatus and just use RCmdStatus
* Assume RCorePlugins returns true/false
2020-05-06 14:38:20 +02:00
Riccardo Schirone
64e6df5004
Extend RCmdDesc with different types (#16738)
* Add RCmdDesc and use it for newshell to call command handlers
* Keep supporting existing RCorePlugin commands
* Properly free RCmdDesc tree
* Remove help from API because not used
* Check for cp->call before using it
* Set res to 0 because otherwise it could exit too early
2020-05-06 14:34:19 +08:00
Riccardo Schirone
169531abb5
Pass parsed arguments directly to RCmd (#16703)
* Remove r_cmd_call_long API because never used
* Remove r_cmd_add_long because never used
* Remove r_cmd_args and fix some spaces
* Add RCmdParsedArgs and unit tests
* Introduce r_cmd_call_parsed_args and use it in cmd.c
* Introduce RCmdParsedArgs in cmd.c
2020-04-24 09:46:43 +02:00
Riccardo Schirone
06ab29b93c
Compile new shell parser by default (#16660)
* Move radare2-shell-parser/tree-sitter into shlr
* compile new shell parser by default, available with cfg.newshell variable
* Add README for radare2-shell-parser
* Improve CI
* Add gitattributes file
2020-04-21 13:44:30 +02:00
Riccardo Schirone
f322c1b1bc
Add support for @* commands in new r2-shell-parser (#16038)
* Use TSSymbol instead of comparing type strings

This patch uses ts_node_symbol instead of ts_node_type to check whether
a node is of a given type. Since TSSymbol is just an integer, the check
will be much faster. Also, it allows to store commands handler in an
hashtable, instead of having if-cascade.

* Make sure r_config_hold works even when keys do not exist or are freed

* Add support for all _tmp_commands

* Make sure to always reuse the same TSLanguage

* Update both tree-sitter and radare2-shell-parser

This way we use TSLanguage version 11, which fixes some problems with
TSSymbols.

* Compute is_last_cmd on each single command and fix logging

is_last_cmd should be set on a per-command basis, so if you analyze
things like `pd 3; .; .; .;` the `.` refers to `pd 3`.

This also fixes logging, so when an invalid command is parsed, it is
still available in the history.

* Add comment about directly using r2-shell-parser in r_core_cmd_lines

r_core_cmd_lines tries to parse the input and split it in lines, but at
least in theory, we don't need it as the new parser can already handle
full scripts.

* Allow other tasks to run between commands even in the new parser

* Update radare2-shell-parser
2020-02-24 09:46:15 +01:00
radare
31e71d340f
Add pkgname in RLibStruct for r2pm on outdated plugins ##core (#15813) 2020-01-15 09:49:41 +01:00
Guillaume Valadon
33bbd373de Use void in function prototypes (#14700) 2019-07-30 16:01:56 +02:00
Florian Märkl
8f87d8aa27 Fix leaks in macros (#12803) 2019-01-16 09:15:39 +01:00
pancake
19c2fb6443 Fix a shitton of warnings 2018-11-14 12:50:30 +01:00
pancake
aeef9d7423 s/deinit/fini/g 2018-05-27 15:55:33 +02:00
Fangrui Song
475edf033d More cfg.newtab=1 completion and misc fixes to help messages (#8184) 2017-08-11 11:45:32 +02:00
Fangrui Song
86de0abd20 Use RList for cmd_descriptors, make it a member of RCore (#8034) 2017-07-27 14:52:17 +02:00
Fangrui Song
3b6f15fab3 Add RCmdDescriptor & cmd.comphint for showing descriptions in command completion (#8002)
It organizes commands as a tree by their names and uses
`r_core_cmd_help (core, desc->help_msg);` currently to show command
candidates.
2017-07-25 15:11:29 +08:00
pancake
5057cb6fb6 Update ABI for debug, core and anal plugs 2017-02-28 02:29:54 +01:00
pancake
94d47c79bb Completely remove all references to list.h 2016-10-27 13:33:27 +02:00
Maijin
530dbe72c1 Save/restore macros in projects fix #4050 2016-02-07 00:51:26 +01:00
Anton Kochkov
4d064d7733 Remove erringly written semicolon in macro 2015-10-06 00:25:02 +03:00
dequis
003a18aa30 A few simple memory leak fixes 2015-08-30 23:20:51 +02:00
pancake
ecf5205e64 Add support for remote aliases with =$ command
For example
	=$dr   - `dr` will do `=!dr`
	=$-dr  - unset that alias command
2015-08-20 02:26:57 +02:00
shuall
0807686d86 #3052 all printf member functions changed to cb_printf 2015-08-09 03:25:05 +02:00
jvoisin
a8937732b8 Fix all 'warning: function declaration isn’t a prototype [-Wstrict-prototypes]' 2015-01-13 03:40:35 +01:00
deeso
3c3443fc2b Adding cmd deinit to core and cmd_api 2014-04-28 10:40:09 -05:00
pancake
a0d3af60ec Fix core.yara plugin 2014-04-27 00:58:31 +02:00
pancake
4e8ab49948 Fix freeing issue in RCore plugins and rename RCmdPlugin to RCorePlugin 2014-04-01 17:17:03 +02:00
pancake
2397c956c9 Use R2_ as unique header guard prefix 2014-03-27 16:34:17 +01:00
pancake
d3af1ea077 Fix #723 - header guards conforming to C standards 2014-03-27 02:32:26 +01:00
pancake
53edf7c17d Merge RCmd inside RCore 2014-03-18 00:05:44 +01:00
Adam Pridgen
62445c5e98 Adding java command plugin and moving the functionality out of the anal/p/anal_java.c code
Added functions to print information about CP Objects and read/write access flags
2014-03-16 22:32:18 -05:00
pancake
2cbce80f2f Add __cplusplus extern "C" boilerplate everywhere 2013-06-18 12:09:23 +02:00
pancake
bc0104563b Initial support for runtime versioned libraries
- This check will ensure you are running the latest r2 version.
2013-06-14 02:51:33 +02:00
pancake
256c0e0bd9 dded r_cmd_alias_del to remove aliases and honor DEBUG=1 2012-10-30 03:22:30 +01:00
pancake
fe6cb8c378 Added '-' to create command aliases and lowercase i8080
Lowercase i8080 disassembler (use e asm.ucase=true)
Add Alexander in AUTHORS
Extend r_cmd api to support aliases
Add new '-' command to register and call command aliases
Use RList in RCmd instead of kernel's list.h
Autocomplete aliases with <tab>
Add 'make DEBUG=1' to compile with -g
Do not strip symbols when compiling in debug mode
2012-10-30 02:49:05 +01:00
Anton Kochkov
e075a18b56 Types cleanups 2012-07-22 12:01:39 +04:00
pancake
d37de2367d * Split libr/core/cmd.c 2012-02-27 02:40:27 +01:00