"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/source/developers-docs.rst" between
cutter-1.10.2.tar.gz and cutter-1.10.3.tar.gz

About: cutter is a Qt and C++ GUI for radare2 reverse engineering framework.

developers-docs.rst  (cutter-1.10.2):developers-docs.rst  (cutter-1.10.3)
skipping to change at line 31 skipping to change at line 31
Example: Example:
.. code:: cpp .. code:: cpp
Core()->getOffset(); Core()->getOffset();
Calling a radare2 command Calling a radare2 command
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
There are two ways to call a radare2 command: There are multiple ways to call a radare2 command:
- ``CutterCore::cmd()`` *(Discouraged)* Only use it for commands which yells no - ``CutterCore::cmdj(<command>)`` - To be used with json commands like ``cmdj("a
output gj")`` or ``cmdj("aflj")``.
- ``CutterCore::cmdj()`` To be used with json commands like ``cmdj("agj")`` or ` This is the command we used to fetch structured data from radare2.
`cmdj("aflj")``.
- ``CutterCore::cmdRaw(<command>)`` - Executes a single radare2 command
without going through radare2 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 v
ariation with ``cmdj`` is always preferred.
- ``CutterCore::cmdRawAt(<command>, <address>)`` - Executes a single radare2 com
mand in a given address and returns the output. This helps avoiding weird string
s 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 sever
al commands (``px 5; pd 7; afl;``), for grepping (``pd 5~call``). for commands i
nside commands (``?e `afn.```) and so on.
This is also used when the output is complex and does not parsed correctly in
``cmdRaw``.
Make sure to carefully sanitize user-controlled variables that are passed to t
he command, to avoid unexpected command injections.
Generally, if one needs to retrieve information from a radare2 command, it Generally, if one needs to retrieve information from a radare2 command, it
is preferred to use the json API. is preferred to use the json API.
Example: Example:
.. code:: cpp .. code:: cpp
QJsonArray array = Core()->cmdj("pdj 1 @ main").array(); QJsonArray array = Core()->cmdj("pdj 1 @ main").array();
skipping to change at line 59 skipping to change at line 69
is important because it will emit a is important because it will emit a
``CutterCore::seekChanged(RVA offset)`` signal. Never ever call ``CutterCore::seekChanged(RVA offset)`` signal. Never ever call
``cmd("s offset")``; ``cmd("s offset")``;
Example: Example:
.. code:: cpp .. code:: cpp
Core()->seek(0x00C0FFEE); Core()->seek(0x00C0FFEE);
.. note::
Cutter also supports a silent seek which doesn't trigger the ``seekChanged`` ev
ent and doesn't add new entries to the seek history.
Creating a widget Creating a widget
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
Make sure to connect the ``CutterCore::seekChanged(RVA offset)`` signal Make sure to connect the ``CutterCore::seekChanged(RVA offset)`` signal
so your widget refreshes its output when radare2 seek is modified so your widget refreshes its output when radare2 seek is modified
(switching to another function, etc.). (switching to another function, etc.).
Coding style Coding style
------------ ------------
 End of changes. 3 change blocks. 
5 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)