Commit Graph

1822 Commits

Author SHA1 Message Date
radare
72093ac706
Fix #16138 - Do not preincrement when it's not necessary (#16151) 2020-03-05 19:06:59 +01:00
radare
5e1d5faebd
Support iter_hit_command and update radare2-shell-parser (#16132) ##core 2020-03-05 14:41:37 +01:00
Riccardo Schirone
d88a76d2df
tree-sitter: support iter commands (#16111) ##core
* radare2-shell-parser: shrink to single-command output when substituing

Before this patch, when substituing arguments the entire input string
was considered, making the process potentially slow if the input was
long. With this patch, substitute_args and parse_args work on a shrinked
version of the input, which includes only the current command.

Not only it improves performance, but it also prevents issues where
other non-related parts of the input string could be replaced during
apply_edits.

* radare2-shell-parser: implement some iter commands
* Add support for number_command and recursive help
* cmd_ignbithints should be set everywhere for consistency
* Save rnum->value before doing a cmd substitution
* Update radare2-shell-parser to fix null deref in html_disable_command
2020-03-03 12:42:38 +01:00
Paul I
3a8388bab6
Fix bug in windbg_read_reg() (#16086) 2020-03-02 13:38:17 +08:00
Óscar Carrasco
aa8c7de595
Implement function names with dots in signatures ##anal (#15993)
* Allow function names containing dots in tcc
2020-02-26 14:23:47 +01:00
pancake
22ac83ca8a Upgrade capstone v4 and next branches 2020-02-25 02:36:56 +01: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
Riccardo Schirone
a295504570 Use the "concatenation" concept in radare2-shell-parser 2020-02-20 00:35:41 +01:00
Khairulmizam Samsudin
e0e27b8c51
sdb header file dependency for external plugin i.e. pyc (#16004) 2020-02-19 19:39:43 +01:00
Khairul Kasmiran
78e21373be Revert "ONE_STREAM_HACK & scr.onestream: Force expected ONE_STREAM order if necessary (#15535)"
This reverts commit 39b40cdedd.
2020-02-17 00:00:46 +01:00
Riccardo Schirone
78db2b12dc new parser: fix multiple words in grep and add support for > $alias 2020-02-14 16:29:36 +01:00
Riccardo Schirone
037a521d39
Use state struct and start handling cmd_substition_arg in tree-sitter (#15966) ##core
* Fix escape/unescape in new shell parser
2020-02-13 20:41:00 +01:00
Hye Sung Jung
757c23d5db Fix spelling errors (#15904) 2020-01-27 07:43:47 +01:00
Riccardo Schirone
65d959f299
Run a travis job that uses the radare2-shell-parser (#15879)
* Run a travis job to use the radare2-shell-parser
* radare2-shell-parser: add support for grep_commands, pipes, and others
2020-01-23 09:10:28 +01:00
Riccardo Schirone
6c2ed0d81b
Update radare2-shell-parser and improve tree-sitter related code in cmd.c (#15875)
* A bit of refactoring in the code that deals with tree-sitter cmds
* Fix redirect_command parsing
* Better handling of last_commands and update radare2-shell-parser
* Fix printing of helps for @, @@, @@@
2020-01-22 11:05:24 +01:00
pancake
35b05d8697 Fix warnings 2020-01-19 17:11:07 -05:00
Riccardo Schirone
f410795ec4 Update radare2-shell-parser 2020-01-19 22:57:40 +01:00
Florian Märkl
3ead80cca8 Remove Custom Analysis for Java (#15817) ##anal 2020-01-16 11:25:49 +01:00
yossizap
f64f2211fb Added reverse step and continue support to gdbr ##debug
This feature only works with server implementations that have ReverseStep
and ReverseContinue enabled, such as rr. The official gdbserver doesn't support it.
2020-01-15 09:49:03 +01:00
Itay Cohen
29c1344ff3 Improve realname support for symbols (#15702) ##bin
* Initial implementation of libname for flags in imports
* Initial support for PE and real flag
* Read libname for PE exports
* implement pj for imports
* Remove imp. prefix from symbol names
* Fix r_core_bin_impaddr()
* Fix some mdmp import stuff
* Print libname in ii
* Fix some imp. checks and reloc meta
* Fix r_bin_filter_sym() for imports
* Use realname for noreturn check
* Fix asm.flags.real for direct calls
* Fix realname for direct calls with fcn
* Fix resolving names from ordinal

Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2020-01-12 03:09:12 +01:00
Anton Kochkov
f3a0a3d01c Some coverity fixes 2020-01-10 12:30:23 +01:00
Riccardo Schirone
46e0a8d169
Do not compile radare2-shell-parser by default (#15769)
Last release (4.1.0) did compile it by default, but the build requires
internet access to download the repositories. For now, since the feature
is anyway very experimental, we disable it at compile time so that
distributions can just compile their packages without internet access.
In the future we may want to use submodules or augment the release
tarball to include the tree-sitter and radare2-shell-parser archives.
2020-01-07 13:37:04 +01:00
yossizap
df8c96d260 Add packed sizes to gdb vector registers and improve mapping of target description to r2 regs ##debug
Some xmm registers were printed as fpu and bnd registers were shown in
all drt categories.
2020-01-04 11:36:48 +01:00
radare
38b5791b63
More improvements for the cmd tests using r2r.v (#15728) 2019-12-30 15:33:09 +01:00
yossizap
bdd597376d Fix gdbr race conditions ##debug
gdbr lock depth wasn't handled in a mutex and there were two point where
a function would exit in a way that breaks the lock count
2019-12-20 13:17:36 +01:00
yossizap
bfa40cd5db Fix gdbr reg sync and concurrency ##debug 2019-12-20 10:17:58 +09:00
Florian Märkl
e408789e34 Fix some Race Conditions with the thready task scheduler (#15667) ##core
* Fix lock ordering of RCoreTaskScheduler.lock vs. RCoreTask.dispatch_lock
* Remove RThreadLock.refs
* Fix a race in tasks
2019-12-18 16:54:37 +01:00
Riccardo Schirone
595cb21ad4 Compile tree-sitter with std=c99 flag (#15654) 2019-12-16 23:21:43 +01:00
Anton Kochkov
d5d5cd3bfa
Some coverity fixes (#15643) 2019-12-16 04:36:46 -06:00
Paul I
9a4578a915 Replace some strstr() calls with strchr() 2019-12-15 23:37:27 +01:00
yossizap
6f546149cf Fixed gdbr warnings and a dpt crash after debug was over ##debug (#15636)
RDebugPid not being initialized with NULL resulted in a free on an invalid
pointer after gdbr_threads_list failed.
2019-12-15 04:45:11 -06:00
Anton Kochkov
e11b2a9145
Some Coverity defect fixes (#15626) 2019-12-13 11:25:19 -06:00
GustavoLCR
e43c9e7caf Fix some warnings (#15549) 2019-12-08 12:49:58 +01:00
yossizap
f12783f4ca Added dp processes info support to gdbr ##debug (#15544)
Most servers/clients should have xml support by now so it should behave
like `dp` in any other debugger. vFile is the only way to get detailed pid info unfortunately.
2019-12-05 13:30:05 +01:00
Khairul Azhar Kasmiran
39b40cdedd
ONE_STREAM_HACK & scr.onestream: Force expected ONE_STREAM order if necessary (#15535) 2019-12-02 23:09:38 +08:00
dav1901
a18640529d Fix spp warning (#15530) 2019-12-01 13:08:48 +01:00
GustavoLCR
ebaf8b603e Fix some warnings on Windows (#15532) 2019-11-30 00:49:16 +01:00
David CARLIER
2fcff51dbc gdbclient reduces risk of use after free down the road ##gdbclient (#15529) 2019-11-29 11:28:52 +01:00
David CARLIER
5e25fc9233 windbg module build warning fix (#15514) 2019-11-28 17:56:45 +01:00
GustavoLCR
78c232b5c5 Impl. list modules for WinDbg ##debug 2019-11-26 12:37:39 +01:00
GustavoLCR
635f27068b Fix WinDbg IO in page boundaries ##debug
Before we didn't check if a virtual address read/write would go through a page boundary. This fixes it.

Also do some formatting and re-enable some useful error messages
2019-11-26 12:37:39 +01:00
GustavoLCR
2ec3bcf044 Fix XP build 2019-11-26 12:37:39 +01:00
yossizap
21cc6e7788 Fixed windbg concurrency and added missing locks ##debug
Previously, windbg_break would freeze waiting on a lock instead of breaking,
taks other than wait weren't breakable and read regs would freeze the
process while waiting for a mutex.
2019-11-25 18:04:16 +01:00
yossizap
a63b7269ce Fixed windbg pipe timeout behavior on linux ##debug
Previously, linux would timeout when trying to connect and would timeout
too frequently since milliseconds were treated as microseconds.
2019-11-25 18:04:16 +01:00
yossizap
9d1421a188 Added rebuild rules for windbg ##debug 2019-11-25 18:04:16 +01:00
yossizap
00f9e84ed1 Fixed windbg continue on windows 7 64bit ##debug
ContinueApi2 only worked on XP 32bit while ContinueApi works on both.
Previously, continue would do a single step.
2019-11-25 18:04:16 +01:00
GustavoLCR
a484d2c6e9 Allow breaking for WinDbg ##debug
* Fix OOB read in windbg_reg_read
* Add locks to prevent collision
* Enable timeouts on the pipe backend
2019-11-25 18:04:16 +01:00
yossizap
8f34771320 Added parsing of gdbr arm/arm64 register features and added a default to >64bit registers
Since r2 doesn't support set/get to large/vector registers (it will still work
when printing gdb's registers with dr/drt or restoring the registers
with reverse stepping), there's a possible issue that the user will get
lots of prints of "r_reg_[get/set]_value: Bit size 128 not supported"
when running various debug commands that use those functions. This fix
simply moves those registers away from gpr to avoid those prints while
still being able to view/restore the registers.
2019-11-20 12:57:33 +01:00
yossizap
68babb75f3 Added parsing support to all gdb registers ##debug
The previous implementation was limited to 64bit registers and didn't
parse the 'feature' field.
2019-11-18 22:56:56 -06:00
yossizap
3c0267fc0a Fix gdbr's reg_write and reg_next_diff for reverse stepping ##debug
Writing registers with gdbr worked with single registers because
reg_next_diff started at delta 0 and only had to run the diff once for
the single register that was changed. When running reverse
stepping/continue, multiple registers are changed at once so
r_reg_next_diff would fail every time due to incorrect offset calculation.
The new r_reg_next_diff also support different register sizes to restore
all registers correctly.
The endianity swapping part from reg_write isn't needed since the arena
is the return value of 'g' which is already in the correct target byte
order (see: https://sourceware.org/gdb/onlinedocs/gdb/Packets.html#read-registers-packet)
2019-11-18 22:56:56 -06:00