Skip to content

Commit

Permalink
change format for commands and remove accidental cuda reference
Browse files Browse the repository at this point in the history
  • Loading branch information
parbenc committed May 15, 2024
1 parent 37ee287 commit 89be441
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions docs/how-to/rocgdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Introduction
`ROCgdb <https://github.com/ROCm/ROCgdb>`_ is the AMD ROCm debugger for Linux targets.

ROCgdb is an extension to GDB, the GNU Project debugger. The tool provides developers
with a mechanism for debugging CUDA applications running on actual hardware. This tool
with a mechanism for debugging ROCm applications running on actual hardware. This tool
enables developers to debug applications without the potential variations introduced
by simulation and emulation environments. It presents a seamless debugging
environment that allows simultaneous GPU and CPU code debugging within the same
Expand Down Expand Up @@ -48,20 +48,26 @@ documentation <https://www.sourceware.org/gdb/documentation/>`_.

First step is to run ROCgdb with your ROCm application:

``rocgdb my_application``
.. code-block:: shell
rocgdb my_application
At this point the application is not running, but you'll have access to the debugger
console. Here you can use every gdb option for host debugging and you can use them and
extra ROCgdb specific features for device debugging.

You'll need to set a breakpoint before you run your application with the debugger.

``tbreak my_app.cpp:458``
.. code-block:: shell
tbreak my_app.cpp:458
This will place a breakpoint at the specified line. To start your application use this
command:

``run``
.. code-block:: shell
run
If the breakpoint is in the device code, the debugger will also show the device and host
threads. The device threads will not be individual threads; instead, they represent a
Expand All @@ -71,29 +77,38 @@ between host threads.
You can also switch between layouts. Use different layouts for different situations while
debugging.

``layout src``
.. code-block:: shell
``layout asm``
layout src
layout asm
The `src` layout is the source code view, while the `asm` is the assembly view. There are
further layouts you can look up in the `GDB documentation
<https://www.sourceware.org/gdb/documentation/>`_.

``info threads``
.. code-block:: shell
info threads
This command lists all threads with id and information on where the thread is stopped.

To switch threads you can use the following command:

``thread <id>``
.. code-block:: shell
thread <id>
To take a step in the execution use:

``n``
.. code-block:: shell
n
To dump the content of the current wavefronts registers use:

``i r``
.. code-block:: shell
i r
The result of this command is just the register dump, which is the all-inclusive data
about the state of the current wavefront, but very difficult to parse.

0 comments on commit 89be441

Please sign in to comment.