Commit graph

52 commits

Author SHA1 Message Date
Ayush
19046106ea
Remove static global variables from armass.c, rtr.c, rtr_http.c, and c.c (#6183) 2026-04-09 00:53:01 +08:00
Khairul Azhar Kasmiran
c1fc1419e4
Rename some rz_list funcs to rz_list_XXX_val (part 1) (#5671)
* Rename rz_list_find_ptr() to rz_list_find_val()
* Rename rz_list_delete_data() to rz_list_delete_val()
2025-12-25 22:01:49 +08:00
Ahmed Kamal
93d914bd81
Remove Global/Static variables in path.c to make it thread safe (#5148) 2025-06-13 21:34:33 +08:00
Giovanni
db1e4993a0
Replace strdup with rz_str_dup (#4634) 2024-09-15 19:12:07 +08:00
wargio
d47ceedbd3 Merge rz_asm and rz_analysis into one library but keep deprecated apis.
The tms320c64x has been merged into tms320.
2024-03-07 18:38:49 +08:00
Huzaifa
e82033d92c
Convert from rz_str_new to rz_str_dup (#4178) 2024-02-07 00:07:53 +08:00
Anton Kochkov
1f4befd24e Remove global RzLine instance 2024-01-07 22:40:25 +08:00
Riccardo Schirone
3b903caa96
librz: add some initial documentation (#3782) 2023-10-13 13:46:19 +08:00
Riccardo Schirone
e933003b5b
librz: do not duplicate plugins (#3313)
* librz: do not duplicate plugins

Plugins structures are statically defined at the file scope and not
dynamically allocated. Plugins should not allocate them either as
RzLibPlugin keeps a reference to them anyway.
2023-01-23 12:51:09 +00:00
Riccardo Schirone
c4767cf1ac
Fix plugin removal and clean code (#3277)
* cmd: Fix summary of few "L" sub-commands
* util: start decluttering plugins handling

- Add Doxygen docs
- Remove unused API functions and make others internal only
- Use RzLibType enum for plugin type instead of int

* util: move dlopen/dlsym/dlclose to rz_sys
* util: make rz_lib_open/close return bool
* util: simplify rz_lib_add_handler and rz_lib_open*
* libs: implement rz_*_plugin_del to remove a plugin
* core: remove commands from RzCmd when removing plugins
* librz: call plugins 'fini' method when removing a plugin
* core/cmd: do not fail if the hashmap removal fails

When removing a group command, the inner command might have the same
name, thus it would result in trying to remove the same name twice.
Ignore it, as it is fine.

* librz: make RzCrypto plugins handling like the others
* librz/crypto: add rz_crypto_reset and use it
* librz: allocate the plugin structures before adding them
2023-01-16 13:32:46 +01:00
Florian Märkl
4e5857cacf
Meson refactor: collect modules in dict and centralize config (#2945)
Duplicated code for pkg-config and cmake configuration is avoided by
letting every rizin module register itself in a global dictionary
called "modules" which is then iterated in one place to perform any
shared logic, inspired by how qemu handles multiple targets in its meson
build system.

This is an almost pure refactor, so the resulting .pc/.cmake files
should be identical with the following exceptions:
- rz_reg.pc does not have plugindir anymore as rz_reg has no plugins.
- Some other modules have their dependencies in .pc files altered to be
  consistent with cmake.
2022-08-20 19:59:27 +02:00
Riccardo Schirone
a689f0a86e librz: refactor a bit how plugins are built
Rely on RZ_ARRAY_SIZE to add librz plugins instead of NULL terminators.
2022-07-20 22:04:02 +02:00
Riccardo Schirone
8939fdbd7d
Use add_global_arguments instead of passing cflags/ldflags all around (#2812)
See also 66a0e22293/docs/TESTING_WITH_SANITIZERS.md (clang)
2022-07-17 21:33:51 +08:00
Riccardo Schirone
969dfd0496 RzLang: handle RzLang plugins as all the others 2022-06-28 21:55:26 +08:00
Riccardo Schirone
cdc80202dd RzCore: add scr.prompt.flag.only config var 2022-05-16 13:16:28 +02:00
Riccardo Schirone
ce6ac3e467 meson: use major/minor only in the lib soversion 2022-05-10 21:04:43 +02:00
Giovanni
bfec86a12e
Add option to install sigdb systemwise and custom user location for additional signatures (#2328) 2022-02-28 14:32:38 +01:00
Riccardo Schirone
6f40dfe493
Move remaining things from shlr/ to meson subprojects (#2126)
* Move binrz meson directives to binrz/ dir

* Move rizin-shell-parser to a subproject

* Move bochs to a meson subproject

* Move rzqnx to meson subproject

* Move winkd to a meson subproject

* Move rzar to a meson subproject

* Move rzw32dbg_wrap to a meson subproject

* Move ptrace-wrap to a meson subproject

* Move rzgdb to a meson subproject

* Rename w32dbg_wrap to rzw32dbg_wrap

* Update CODEOWNERS

* Remove old references to shlr

* Move shlr/heap stuff in core and remove shlr/arm

* Move spp to a meson subproject

* Remove last references to shlr

* Remove use_webui option

* Move include files directives to librz/include/meson.build

* Move librz meson directives into librz/meson.build

* Handle d/ directories inside the specific module meson.build

* Move plugins listing to specific module meson.build

* Move rzheap to its own subproject

* Fix js linter and licenses

* Use meson.override_dependency for all rz_ modules
2021-12-22 09:20:39 +08:00
Riccardo Schirone
47e1cb8335
Provide CMake config files for CMake projects (#2057)
* Remove wrong librz.pc.in file
* Add plugindir variable to .pc files to allow easy plugin configuration
* Add CMake config files to find Rizin in CMake projects
* Add CI jobs to check cmake files
* Provide workaround for mesonbuild/meson#9702
* Use .lib suffix and no prefix on MSVC to make CMake files work
* Disable cmake files on static libraries build
2021-12-17 09:16:25 +00:00
Riccardo Schirone
64469f2811
Changes in how paths are handled (#1997)
* Remove `RIZIN_EXTRAS` because useless

Extras plugin should be treated as any other regular plugin, they should
not have their own directory. I believe we did not have anyway any
plugin using that directory.

* Do not use `<version>` in `/usr/share`

Users can only install one version of Rizin at a time anyway, thus
splitting the `/usr/share/rizin` directories does not really bring
multi-version install possible. At the same time, we stick to what's
common for other tools, which do not use version in `/usr/share`

* Move plugin directory to `/usr/lib64/rizin/plugins`
* Remove `RZ_HOME_BIN` env var because not useful anymore
* Introduce `rz_util/rz_path` to provide rizin paths
* Use `rz_path_system_sdb_types` whenever it makes sense
* Use some others `rz_path_*` functions instead of custom ones
* Use `rz_path` APIs for themes, fortunes and signatures
* Remove `rz_sys_prefix`
* Reduce the number of defines needed to handle home and system paths
* Reduce the number of `rz_path` functions
* Make the lib debug depending on log level and `RZ_LOG_DEBUG`
* Refactor a bit how directory of plugins are loaded
* Keep supporting old plugins directory for at least 0.4.0
2021-11-30 13:36:38 +08:00
Dhruv Maroo
34d345d884 Format according to clang-format-13 2021-11-25 15:44:28 +08:00
Khairul Azhar Kasmiran
906ece4211
Add asan build for clang (#1910) 2021-11-17 21:02:02 +08:00
Anton Kochkov
fe373208eb
Remove editor from RzCons (#1771) 2021-10-01 16:34:30 +08:00
Riccardo Schirone
6aef990eef Fix few clang-cl warnings 2021-09-04 12:06:07 +02:00
Anton Kochkov
ef9a93a57c Remove unused RzLang Vala tests 2021-07-20 01:49:21 +08:00
Anton Kochkov
de48cc521d
Cleanup of RzLang (#1206) 2021-06-10 10:24:49 +02:00
Theofilos Pechlivanis
07b937e235 Print the rizin plugin info in json ##print ##json
* Implement `aLj` in cmd_analysis.c ##print ##json
* Replace `,` with a `:` in `Loj` json ##test
* Replace `L` and `Lj` with `Ll` and `Llj` ##test
* Add tests for rz plugin json cmds ##print ##json
* List BinLdrPlugins for `Lij` ##print ##json
* Add spaces to represent no authors for `Li` ##test
* Convert `L` and `Ll` to newshell
* Convert `La` and `Laj` to newshell
* Move `Ll` handler to `clang.c`, rename `La` handler ##print ##json
* Convert `Lc` to newshell ##print ##json
* Convert `Ld` cmd to newshell ##print ##json
* Add `Laq` cmd test ##test
* Convert `Lh` to newshell and fix `La` check ##print ##json
* Fix `Lh` and convert `Li` cmd to newshell ##print ##json
* Convert `Lo` to newshell and modify `Lh` ##print ##json ##test
* Convert `Lp` to newshell ##print ##json ##test
* Use newshell cmd for `aL` ##print ##json
* Fix `Li`, lowercase json properties, add tests ##print ##json ##test
* Fix `Ld` and add `Lds` to set dbg backend ##print ##json ##test
* Revert `oL` and `aL` and replace `Lds` with `Ld` ##print ##json
* Use newshell for `obL`
* Replace `lang->cb_printf` with `rz_cons_printf`
* Replace `bin->cb_printf` with `rz_cons_printf` ##print
* Use `rz_lang_list()` instead of cmd0 ##print
* Set `Lo` and `Loj` tests as broken ##test
2021-05-17 13:38:11 +08:00
Paul I
752736ed32
Link sdb and spp libs wholly to rz_util (#951) 2021-04-07 02:32:48 +08:00
Riccardo Schirone
53bf5c497f SPDX Copyright text for all files based on history
- Add LICENSES directory
- Download additional licenses used
- Add .reuse directory
- Add doc about SPDX/reuse

Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2021-03-05 19:39:15 +08:00
Riccardo Schirone
53b4537160 Introduce portable build option to use relative paths
`portable` makes rizin use paths relative to the executable binary path,
so that all resource files (e.g. SDB files) can be retrieved without
having an hard-coded prefix in the binary. By doing so, rizin
installation directory can be moved from location to location and still
work. This is useful when having a static rizin that you want to execute
on another system.

It makes sure that all PATHs defined in rz_userconf.h are just relative
to the prefix and that, in the code, the prefix is prepended to all
these paths.
2021-02-25 19:41:38 +08:00
Alexis Ehret
162322634e Fix coding style javascript files (prettier) 2021-02-12 17:30:02 +01:00
Riccardo Schirone
cee8d470c2 Remove Makefiles and many related scripts 2021-01-28 11:57:28 +01:00
Anton Kochkov
a0be4e2e64 Run clang-format 2021-01-21 22:05:44 +08:00
Aswin C
93101e1288
Remove an empty and useless Makefile in librz/lang ##lang (#395) 2021-01-19 23:39:57 +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
Anton Kochkov
e9d91af698 More Rizin renames 2021-01-05 05:21:41 -06:00
Florian Märkl
40a29cba29
Remove Pseudo-Sandbox (#239) 2020-12-21 21:31:32 +01: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
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
Giovanni
35a9ef94c9
Code and comments cleanup (#108) 2020-12-04 18:11:51 +08:00
Anton Kochkov
7ee14fb853 More renames 2020-11-12 12:27:04 +08:00
Anton Kochkov
afc45bec46 Rename r2 to rizin 2020-11-06 12:21:54 +08:00
Anton Kochkov
539f60a1a8
Rename radare to rizin (#68)
* Rename radare to rizin

- Rename REvent to RzEvent
- Rename RBreakpoint to RzBreakpoint
- Rename RRune to RzRune

* Remove unnecessary files
2020-11-04 18:56:27 +08:00
Florian Märkl
dbe28c61a4 Fix Windows RZ_PIPE_PATH env var 2020-11-03 11:49:59 +08:00
Florian Märkl
6572b63794
Use Standard SPDX Header Comments (#51) 2020-10-27 09:04:11 +01:00
Anton Kochkov
1ef15faaee Rename R2DEPS to RZ_DEPS 2020-10-23 15:19:22 +08:00
Riccardo Schirone
7ceebc725e Mass renaming r2 to rz/rizin 2020-10-13 12:43:34 +02:00
Riccardo Schirone
3a20249e76 Make sure spp supports "rizin" tag and fix tests 2020-10-05 16:27:40 +02:00
Anton Kochkov
3fb31afa16
Rename r2 to {rz|rizin} (#14) 2020-10-05 21:39:56 +08:00
Riccardo Schirone
502e91aff7
Rename R_ and R2_ to RZ_ (#8)
* Rename R2_ -> RZ_
* Rename R_ -> RZ_
* Rename R2R_ -> RZ_TEST_
* Rename R2R defines and types to RZ_TEST/RzTest
* Keep R_ for REIL registers
2020-10-02 16:09:13 +02:00