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

docs: remove mention of Rizin cmd calls #3337

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
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
27 changes: 0 additions & 27 deletions docs/source/contributing/code/development-guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,6 @@ Example:

Core()->getOffset();

Calling a Rizin Command
~~~~~~~~~~~~~~~~~~~~~~~~~

There are multiple ways to call a Rizin command:

- ``CutterCore::cmdj(<command>)`` - To be used with json commands like ``cmdj("agj")`` or ``cmdj("aflj")``.
This is the command we used to fetch structured data from Rizin.

- ``CutterCore::cmdRaw(<command>)`` - Executes a single Rizin command
without going through Rizin shell functionality like output redirects, grep, and multiple command parsing.

The command then returns its output. This should be used when a command doesn't have output or the output should be handled as-is. If possible, using the JSON variation with ``cmdj`` is always preferred.

- ``CutterCore::cmdRawAt(<command>, <address>)`` - Executes a single Rizin command in a given address and returns the output. This helps avoiding weird strings concatenation like ``cmd("ph " + hash + " @ " + QString::num(address))``.

- ``CutterCore::cmd()`` - *(Discouraged)* Only use it when ``cmdj`` or ``cmdRaw`` cannot be used. This is used for complex commands using concatenation of several commands (``px 5; pd 7; afl;``), for grepping (``pd 5~call``). for commands inside commands (``?e `afn.```) and so on.
This is also used when the output is complex and is not parsed correctly in ``cmdRaw``.
Make sure to carefully sanitize user-controlled variables that are passed to the command, to avoid unexpected command injections.

Generally, if one needs to retrieve information from a Rizin command, it
is preferred to use the JSON API.

Example:

.. code:: cpp

CutterJson array = Core()->cmdj("pdj 1 @ main");

Seek the Current File
~~~~~~~~~~~~~~~~~~~~~
Expand Down
Loading