Skip to content

Commit

Permalink
update docs from rizinorg/cutter (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Surendrajat authored Dec 20, 2020
1 parent d838ea6 commit 26dabe3
Show file tree
Hide file tree
Showing 411 changed files with 2,936 additions and 2,455 deletions.
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 59cf9224db0793fe9859a9634e100b3b
config: 2886cd5173c0bbed70bcfcbb8ac03722
tags: 645f666f9bcd5a90fca523b33c5a78b7
4 changes: 0 additions & 4 deletions docs/_sources/api/common/classR2Task.rst.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_sources/api/common/classRizinTask.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RizinTask
=========

.. doxygenclass:: RizinTask
4 changes: 0 additions & 4 deletions docs/_sources/api/core/classRCoreLocked.rst.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_sources/api/core/classRzCoreLocked.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RzCoreLocked
============

.. doxygenclass:: RzCoreLocked
4 changes: 0 additions & 4 deletions docs/_sources/api/core/structRAsmPluginDescription.rst.txt

This file was deleted.

4 changes: 0 additions & 4 deletions docs/_sources/api/core/structRBinPluginDescription.rst.txt

This file was deleted.

4 changes: 0 additions & 4 deletions docs/_sources/api/core/structRCorePluginDescription.rst.txt

This file was deleted.

4 changes: 0 additions & 4 deletions docs/_sources/api/core/structRIOPluginDescription.rst.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_sources/api/core/structRzAsmPluginDescription.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RzAsmPluginDescription
======================

.. doxygenstruct:: RzAsmPluginDescription
4 changes: 4 additions & 0 deletions docs/_sources/api/core/structRzBinPluginDescription.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RzBinPluginDescription
======================

.. doxygenstruct:: RzBinPluginDescription
4 changes: 4 additions & 0 deletions docs/_sources/api/core/structRzCorePluginDescription.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RzCorePluginDescription
=======================

.. doxygenstruct:: RzCorePluginDescription
4 changes: 4 additions & 0 deletions docs/_sources/api/core/structRzIOPluginDescription.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RzIOPluginDescription
=====================

.. doxygenstruct:: RzIOPluginDescription
4 changes: 0 additions & 4 deletions docs/_sources/api/dialogs/classR2PluginsDialog.rst.txt

This file was deleted.

4 changes: 0 additions & 4 deletions docs/_sources/api/dialogs/classR2TaskDialog.rst.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_sources/api/dialogs/classRizinPluginsDialog.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RizinPluginsDialog
==================

.. doxygenclass:: RizinPluginsDialog
4 changes: 4 additions & 0 deletions docs/_sources/api/dialogs/classRizinTaskDialog.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RizinTaskDialog
===============

.. doxygenclass:: RizinTaskDialog
4 changes: 0 additions & 4 deletions docs/_sources/api/dialogs/classSaveProjectDialog.rst.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_sources/api/dialogs/structDbgBackend.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DbgBackend
==========

.. doxygenstruct:: DbgBackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DisassemblyContextMenu::DoRenameInfo
====================================

.. doxygenstruct:: DisassemblyContextMenu::DoRenameInfo
4 changes: 0 additions & 4 deletions docs/_sources/api/widgets/classGenericR2GraphView.rst.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_sources/api/widgets/classGenericRizinGraphView.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GenericRizinGraphView
=====================

.. doxygenclass:: GenericRizinGraphView
4 changes: 0 additions & 4 deletions docs/_sources/api/widgets/classR2GraphWidget.rst.txt

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_sources/api/widgets/classRizinGraphWidget.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RizinGraphWidget
================

.. doxygenclass:: RizinGraphWidget
53 changes: 26 additions & 27 deletions docs/_sources/building.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Building
.. note::

If you just want to use the latest Release version of Cutter, please note
that we provide pre-compiled binaries for Windows, Linux and macOS on
our `release page. <https://github.com/radareorg/cutter/releases/latest>`_
that we provide pre-compiled binaries for Windows, Linux, and macOS on
our `release page. <https://github.com/rizinorg/cutter/releases/latest>`_

Getting the Source
------------------
Expand All @@ -14,17 +14,17 @@ Make sure you've ``git`` installed in your system (`Installation guide <https://

.. code-block:: sh
git clone --recurse-submodules https://github.com/radareorg/cutter
git clone --recurse-submodules https://github.com/rizinorg/cutter
This will clone the Cutter source and it's dependencies(radare2, etc.)
This will clone the Cutter source and its dependencies(rizin, etc.)
under **cutter** and you should see the following dir structure:

.. code-block:: sh
cutter/-|
|-docs/ # Cutter Documentation
|-radare2/ # radare2 submodule
|-rizin/ # Rizin submodule
|-src/ # Cutter Source Code
Following sections assume that **cutter** is your working dir. (if not, do ``cd cutter``)
Expand Down Expand Up @@ -72,23 +72,23 @@ On Arch-based Linux distributions:
Building Steps
~~~~~~~~~~~~~~

The recommended way to build Cutter on Linux is by using CMake. Simply invoke CMake to build Cutter and its dependency radare2.
The recommended way to build Cutter on Linux is by using CMake. Simply invoke CMake to build Cutter and its dependency Rizin.

.. code:: sh
mkdir build && cd build
cmake -DCUTTER_USE_BUNDLED_RADARE2=ON ../src
cmake -DCUTTER_USE_BUNDLED_RIZIN=ON ..
cmake --build .
If your operating system has a newer version of CMake (> v3.12) you can use this cleaner solution:

.. code:: sh
cmake -S src -B build -DCUTTER_USE_BUNDLED_RADARE2=ON
cmake -B build -DCUTTER_USE_BUNDLED_RIZIN=ON
cmake --build build
.. note::
If you want to use Cutter with another version of radare2 you can omit ``-DCUTTER_USE_BUNDLED_RADARE2=ON``. Note that using a version of radare2 which isn't the version Cutter is using can cause issues and the compilation might fail.
If you want to use Cutter with another version of Rizin you can omit ``-DCUTTER_USE_BUNDLED_RIZIN=ON``. Note that using a version of Rizin which isn't the version Cutter is using can cause issues and the compilation might fail.

.. note::

Expand Down Expand Up @@ -130,7 +130,6 @@ Note that the paths below may vary depending on your version of Qt and Visual St
.. code:: batch
set CMAKE_PREFIX_PATH=c:\Qt\qt-5.6.2-msvc2013-x86\5.6\msvc2013\lib\cmake
cd src
mkdir build
cd build
cmake-gui ..
Expand Down Expand Up @@ -179,7 +178,7 @@ To compile Cutter, run:

.. code:: batch
CALL prepare_r2.bat
CALL prepare_rizin.bat
CALL build.bat
Expand All @@ -199,7 +198,7 @@ QtCreator will then allow you to directly edit the source code and build the pro
.. note::

On **Windows**, for the ``.pro`` file to be compiled successfully, it is required
to run ``prepare_r2.bat`` beforehand.
to run ``prepare_rizin.bat`` beforehand.

Compiling on Linux / macOS
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -235,7 +234,7 @@ CMake Building Options

Note that there are some major building options available:

* ``CUTTER_USE_BUNDLED_RADARE2`` automatically compile Radare2 from submodule.
* ``CUTTER_USE_BUNDLED_RIZIN`` automatically compile Rizin from submodule.
* ``CUTTER_ENABLE_PYTHON`` compile with Python support.
* ``CUTTER_ENABLE_PYTHON_BINDINGS`` automatically generate Python Bindings with Shiboken2, required for Python plugins!
* ``CUTTER_ENABLE_KSYNTAXHIGHLIGHTING`` use KSyntaxHighlighting for code highlighting.
Expand All @@ -245,7 +244,7 @@ Note that there are some major building options available:
Cutter binary release options, not needed for most users and might not work easily outside CI environment:

* ``CUTTER_ENABLE_CRASH_REPORTS`` is used to compile Cutter with crash handling system enabled (Breakpad).
* ``CUTTER_ENABLE_DEPENDENCY_DOWNLOADS`` Enable downloading of dependencies. Setting to OFF doesn't affect any downloads done by r2 build. This option is used for preparing Cutter binary release packges. Turned off by default.
* ``CUTTER_ENABLE_DEPENDENCY_DOWNLOADS`` Enable downloading of dependencies. Setting to OFF doesn't affect any downloads done by Rizin build. This option is used for preparing Cutter binary release packges. Turned off by default.
* ``CUTTER_PACKAGE_DEPENDENCIES`` During install step include the third party dependencies. This option is used for preparing Cutter binary release packges.


Expand Down Expand Up @@ -306,33 +305,33 @@ containing bin/, lib/, include/, etc.) and specify it to CMake using
rm CMakeCache.txt # the cache may be polluted with unwanted libraries found before
cmake -DCMAKE_PREFIX_PATH=/opt/Qt/5.9.1/gcc_64 ..

* **Radare2's libr_*.so cannot be found when running Cutter**
* **Rizin's librz_*.so cannot be found when running Cutter**

./Cutter: error while loading shared libraries: libr_lang.so: cannot open shared object file: No such file or directory
./Cutter: error while loading shared libraries: librz_lang.so: cannot open shared object file: No such file or directory

The exact r2 .so file that cannot be found may vary. On some systems, the linker by default uses RUNPATH instead of RPATH which is incompatible with the way r2 is currently compiled. It results in some of the r2 libraries not being found when running cutter. You can verify if this is the problem by running `ldd ./Cutter`. If all the r2 libraries are missing you have a different problem.
The workaround is to either add the `--disable-new-dtags` linker flag when compiling Cutter or add the r2 installation path to LD_LIBRARY_PATH environment variable.
The exact Rizin .so file that cannot be found may vary. On some systems, the linker by default uses RUNPATH instead of RPATH which is incompatible with the way Rizin is currently compiled. It results in some of the Rizin libraries not being found when running cutter. You can verify if this is the problem by running `ldd ./Cutter`. If all the Rizin libraries are missing you have a different problem.
The workaround is to either add the `--disable-new-dtags` linker flag when compiling Cutter or add the Rizin installation path to LD_LIBRARY_PATH environment variable.

::

cmake -DCMAKE_EXE_LINKER_FLAGS="-Wl,--disable-new-dtags" ..

* **r_*.h: No such file or directory**

r_util/r_annotated_code.h: No such file or directory
rz_util/rz_annotated_code.h: No such file or directory

If you face an error where some header file starting with ``r_`` is missing, you should check the **radare2** submodule and
If you face an error where some header file starting with ``rz_`` is missing, you should check the **rizin** submodule and
make sure it is in sync with upstream **Cutter** repo. Simply run:

::

git submodule update --init --recursive

* **r_core development package not found**
* **rz_core development package not found**

If you installed radare2 and still encounter this error, it could be that your
If you installed Rizin and still encounter this error, it could be that your
``PATH`` environment variable is set improperly (doesn’t contain
``/usr/local/bin``). You can fix this by adding the radare2 installation dir to
``/usr/local/bin``). You can fix this by adding the Rizin installation dir to
your ``PATH`` variable.

macOS specific solutions:
Expand All @@ -345,13 +344,13 @@ encounter any problems.

You can also try:

- ``PKG_CONFIG_PATH=$HOME/bin/prefix/radare2/lib/pkgconfig qmake``
- ``PKG_CONFIG_PATH=$HOME/cutter/radare2/pkgcfg qmake`` (for a newer
version and if the radare2 submodule is being built and used)
- ``PKG_CONFIG_PATH=$HOME/bin/prefix/rizin/lib/pkgconfig qmake``
- ``PKG_CONFIG_PATH=$HOME/cutter/rizin/pkgcfg qmake`` (for a newer
version and if the rizin submodule is being built and used)

.. image:: images/cutter_path_settings.png

You can also install radare2 into ``/usr/lib/pkgconfig/`` and then
You can also install Rizin into ``/usr/lib/pkgconfig/`` and then
add a variable ``PKG_CONFIG_PATH`` with the value ``/usr/lib/pkgconfig/``.

* **macOS libjpeg error**
Expand Down
34 changes: 17 additions & 17 deletions docs/_sources/contributing/code/development-guidelines.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Common Usage
CutterCore Class
~~~~~~~~~~~~~~~~

This is the main class where every link with r2 is made. It is *unique*
This is the main class where every link with Rizin is made. It is *unique*
across the whole process. To access it, simply call ``Core()``.

Example:
Expand All @@ -21,26 +21,26 @@ Example:
Core()->getOffset();
Calling a radare2 Command
Calling a Rizin Command
~~~~~~~~~~~~~~~~~~~~~~~~~

There are multiple ways to call a radare2 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 radare2.
This is the command we used to fetch structured data from Rizin.

- ``CutterCore::cmdRaw(<command>)`` - Executes a single radare2 command
without going through radare2 shell functionality like output redirects, grep, and multiple command parsing.
- ``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 radare2 command in a given address and returns the output. This helps avoiding weird strings concatenation like ``cmd("ph " + hash + " @ " + QString::num(address))``.
- ``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 radare2 command, it
Generally, if one needs to retrieve information from a Rizin command, it
is preferred to use the JSON API.

Example:
Expand All @@ -52,7 +52,7 @@ Example:
Seek the Current File
~~~~~~~~~~~~~~~~~~~~~

To modify radare2 seek use ``CutterCore::seek(const RVA offset)``. This
To modify Rizin seek use ``CutterCore::seek(const RVA offset)``. This
is important because it will emit a
``CutterCore::seekChanged(RVA offset)`` signal. Never ever call
``cmd("s offset")``;
Expand All @@ -72,7 +72,7 @@ Creating a Widget
~~~~~~~~~~~~~~~~~

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 Rizin seek is modified
(switching to another function, etc.).

Coding Style
Expand Down Expand Up @@ -225,10 +225,10 @@ Updating the Git Submodules
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Git submodules play a major part in Cutter. This, because Cutter is powered
by radare2, its parent project, and it tries to stay up-to-date with its
by Rizin, its parent project, and it tries to stay up-to-date with its
recent version, which allows us to implement new features, and enjoy bug
fixes and performance improvements on radare2. Often, we need to update
the radare2 submodule or the others, to push their most recent
fixes and performance improvements on Rizin. Often, we need to update
the Rizin submodule or the others, to push their most recent
version to Cutter.

You can view the list of all the submodules from the cutter root folder with:
Expand All @@ -246,16 +246,16 @@ cutter root folder:
git add submodule_name_1 submodule_name_2
git commit -m "Update submodules"
More likely, you'll only need to update the radare2 submodule.
More likely, you'll only need to update the *rizin* submodule.
In order to update one submodule individually, use the following code:

.. code:: sh
cd radare2
cd rizin
git checkout master && git pull
cd ..
git add radare2
git commit -m "Update radare2 submodule"
git add rizin
git commit -m "Update rizin submodule"
Useful Resources (Qt Development)
Expand Down
Loading

0 comments on commit 26dabe3

Please sign in to comment.