Commit graph

90 commits

Author SHA1 Message Date
Anton Kochkov
a0be4e2e64 Run clang-format 2021-01-21 22:05:44 +08:00
eagleoflqj
e22b403744 Use pj in cmd_print ##refactor 2021-01-21 18:04:03 +08:00
Riccardo Schirone
144ba639dc
Convert s commands to newshell (#375)
* Rename `sj`/`s*` and move them under `sH`. Remove `s=`
* Rename `s-*` to `sH-`
* Use `sd` for "seek delta", which moves relative to the current offset
* Enforce <cmd> <arg> syntax. So no more `s+16` but `s +16`. Command
  `sHr` is for redo history, `sHu` for undo history. If one wants to move
  relative to the current address, they need to do `sd +10`/`sd -10`.
* Remove `ss` commands in favour of `cmd.seek.silent`. This was anyway
  used mainly for scripts, so no need to replicate all `s` commands
  under `ss`.

Change a bit rz_core_seek API to avoid dupped entries in seek history.
2021-01-20 10:30:20 +08:00
Khairul Azhar Kasmiran
d5601cc2fe
Replace naked rz_sys_system/write/read/freopen calls with their wrapped counterparts (#388) 2021-01-19 00:07:19 +08:00
Giovanni
9ce8de9cde
Removed TTS (#374) 2021-01-17 23:32:42 +01:00
Alexis Ehret
a3a339b11b Refactoring function rz_str_isnumber 2021-01-16 14:08:11 +00:00
Alexis Ehret
90033b8fe3 Fix dead increment librz/util/buf.c 2021-01-16 14:08:11 +00:00
Alexis Ehret
58a059e473 Refactoring function rz_type_func_guess 2021-01-16 14:08:11 +00:00
Alexis Ehret
c12d02c1ba Fix dead increment librz/util/utype.c 2021-01-16 14:08:11 +00:00
pancake
486ed69698 Fix plugin type name array issue in Lc command 2021-01-16 14:13:18 +01:00
pancake
655757b047 Fix issues spotted with gcc -Werror 2021-01-14 20:05:24 +08:00
Riccardo Schirone
5bf8aa5b0f
Remove lines cache (#343)
* Add some doc for RzCmdDesc

* Remove lines_cache, sl, prl

* Remove sl/prl tests and autocompletion
2021-01-12 00:35:24 +01:00
eagleoflqj
12d51eedd4 Fix rizin - tab crash related to regex apis 2021-01-11 17:54:24 +08:00
Dennis Goodlett
47b579839d Fix underflow in rz_list_pop 2021-01-11 17:54:24 +08:00
liumeo
59a4792d43 Use pj in dmj, dmhj & fix regex ##refactor 2021-01-11 17:54:24 +08:00
Giovanni
1c5b008bcd
Fixing clang flow warnings (#321)
* Fixed memleak on rz_diffchar_new
* extended_arg is not used after line 87
* useless assignment
* use imm not opnd->addr.offset.imm
* fixing usage of op and memleaks related to it
* invalid cc usage on rz_debug_arg_get
* null ptr deref and memleak in gdb_to_rz_profile
* Fixed logic on instruction decoding on amd29k
* Fixed undef negative shift and memleak on mips assembler
2021-01-10 19:38:43 +01:00
Anton Kochkov
fb7d7df1ec Remove Mingw and Cygwin from ACR build 2021-01-09 08:46:31 +08:00
Riccardo Schirone
07c5c7a510 Use rz_buf_size and pass permissions to ar_open_file
* Extract rz_sys_open_perms to convert from rizin permissions to posix
2021-01-08 16:40:53 +01:00
Alexis Ehret
fe73c1af16
Remove all dead assignment detect by clang sa (#310) 2021-01-07 10:00:02 +01:00
Riccardo Schirone
e7f9be7c3e Add rizin eval autocompletion ##newshell 2021-01-05 23:33:32 -06:00
Riccardo Schirone
ed8525e46f Rewrite rz_str_split functions with unit tests 2021-01-05 23:33:32 -06:00
eagleoflqj
7de08c4641 Fix s390x test_buf 2021-01-05 05:21:41 -06:00
Liumeo
65f1e5d260 Fix s390x rz-ax -I & memleak (#18151) 2021-01-05 05:21:41 -06:00
Riccardo Schirone
7316b71619 Simplify io_default with RzBuffer 2021-01-03 11:42:38 +01:00
Riccardo Schirone
0cf9979f42 Add fd to RzBuf and add mode to mmap RzBuf 2021-01-03 11:42:38 +01:00
Riccardo Schirone
d25cea5420 Rewrite rz_file_mmap API 2021-01-03 11:42:38 +01:00
Riccardo Schirone
73080975d4 Fix autocompletion unit tests on Windows by using RZ_SYS_DIR 2021-01-03 11:42:38 +01:00
Maijin
dcb9f987ae
Remove EMSCRIPTEN__TODO and TODO (#265)
* Remove unused TODO(x)
* Remove unused Emscripten

Co-authored-by: Maijin <maijin21@gmail.com>
2020-12-30 13:59:38 +08:00
yossizap
cf53347730
Added support for regex in test output ##test (#269)
* Added REGEX/_ERR to enable regex in EXPECT/_ERR ##test
* Modify output based on REGEXP_OUT/ERR and compare with EXPECT/ERR ##test
2020-12-28 12:04:35 +02:00
Liumeo
45d113d89a Fix arm32 db/cmd/cmd_pc (#18053) 2020-12-22 08:26:41 +08:00
Liumeo
865b95ffe6 Fix arm32 db/cmd/cmd_i (#18056) 2020-12-22 08:26:41 +08:00
Florian Märkl
40a29cba29
Remove Pseudo-Sandbox (#239) 2020-12-21 21:31:32 +01:00
Anton Kochkov
5d07857260 Rename RBitmap to RzBitmap 2020-12-21 17:57:02 +08:00
Anton Kochkov
ecacfb9c8f Rename RTable to RzTable 2020-12-21 17:57:02 +08:00
Riccardo Schirone
69f3da16d0
rz_sys_system should not depend on LIBC_HAVE_FORK (#226) 2020-12-21 09:15:25 +01:00
Riccardo Schirone
a0e8808994
Use async-signal-safe functions after fork in multithread program (#207)
* Do not use setenv after fork, it's not async-signal-safe
* Do not use mutexes after fork

If pipe2 is not available on a system, we try to simulate the atomic
setting of O_CLOEXEC in different ways (depending on whether O_CLOEXEC
is at least available or not). However this involves using mutexes. When
forking, only the calling thread is forked, so it is important to lock
the mutex before the fork. However, in the child between the fork and
the exec* it is recommended to use only async-signal-safe functions. mutex
operations are not async-signal-safe, so we just keep track of whether we are
in the child or not and avoid using the mutex as necessary.

* Replace pthread_atfork with rz_sys_fork
2020-12-18 19:32:06 +01:00
yossizap
e08a87ee89
Fix a crash in dts+ command with empty register arenas ##debug (#172)
* Fix a crash in dts+ command with empty register arenas ##debug
* Allow empty arena bytes when allocating a new arena ##reg
* Added rz_mem_copy as a safe memcpy alternative ##utils

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2020-12-17 18:46:46 +08:00
Riccardo Schirone
aefce4161e
Make it possible to have escape char in cmd_identifier ##newshell (#185)
* Make it possible to have escape char in cmd_identifier ##newshell

Fixes: https://github.com/rizinorg/rizin/issues/97

* Add test to check the non existance of "wv8@10" command identifier
2020-12-17 14:48:42 +08:00
Maijin
95e5ee48ce
Remove p3 command (#194) 2020-12-16 00:03:12 +01:00
Riccardo Schirone
3aca1e2b91 Avoid extra calls in rz_sys wrappers if functions are not needed 2020-12-15 10:18:50 +01:00
Riccardo Schirone
5307116b1d Implement rz_sys_pid_to_path in OpenBSD 2020-12-15 10:18:50 +01:00
Riccardo Schirone
5d6426508a Make rz_subprocess_lock/unlock private 2020-12-15 10:18:50 +01:00
Riccardo Schirone
286f930b93 Use O_CLOEXEC when creating pipes so they are closed on exec
By default, pipes file descriptors are not closed on exec. This means
they are inherited by the child process. However, this may be a problem
in particular in multi-threading programs (e.g. rz-test), because EOF is
not sent to a pipe until the last pipe file descriptor is closed.

This commit makes sure that by default pipes are created with O_CLOEXEC,
so they are closed whenever an exec syscall is executed. Usually pipe
file descriptors are duplicated to be stdin/stdout/stderr of the
children process and those dupped file descriptors won't be closed on
exec.

In case pipe2 is not available (e.g. MacOS), we do a pipe + fcntl, which
is in theory racy (see man open(2)). For this reason pipe, exec, system,
etc. are wrapped in rz_sys and they use a global mutex to make sure a
pipe is either created and set as O_CLOEXEC or not created at all before
an exec operation is done.

On very old systems, O_CLOEXEC may not be available at all. In those
cases, which should be rare, we just keep a list of file descriptors
created with rz_sys_pipe that we need to close before executing another
process.

Interaction with external libs may be tricky. We expect external libs to
create files/pipes that need to be closed on exec with the right flags
and we expect rizin code to manually close pipes file descriptors as
appropriate if the exec syscall is executed by an external library
(non-rizin code).

Make sure execl is found by acr/make
2020-12-15 10:18:50 +01:00
Riccardo Schirone
5ea4697402 Use RzSubprocess in rz_test 2020-12-15 10:18:50 +01:00
Riccardo Schirone
09d305ec10 Extract subprocess API used in rz-test into RzUtil 2020-12-15 10:18:50 +01:00
Florian Märkl
d53d1e3845
Final Analysis Renaming (#124)
* Rename missing Analysis Defines
* Rename analysis config vars and other lower case stuff
* Rename test/db/analysis
* Fix analysis tests

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2020-12-08 15:05:24 +08:00
GustavoLCR
b823017cb1 PDB: Fix NULL deref with unsupported leaf type (#17996) ##bin 2020-12-07 23:18:29 -06:00
Anton Kochkov
ad36954adb
More renames of *anal* to *analysis* (#123) 2020-12-07 13:20:29 +01:00
Anton Kochkov
041d73dce3
Change the "anal" abbreviation to "Analysis" in Code (#117) 2020-12-06 19:25:27 +01:00
Giovanni
35a9ef94c9
Code and comments cleanup (#108) 2020-12-04 18:11:51 +08:00