> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/readme/developing_applications/pg_vos3_debugging_applications.md).

# Debugging VOS3 Applications

The toolchain includes a gdb that can be used for remote debugging applications on the terminal.

## Installing Debugger <a href="#vos3_debugging_applications_installing_debugger" id="vos3_debugging_applications_installing_debugger"></a>

There is no need to install additional software beside the VOS3 toolchain.

The GNU debugger is located in the toolchain as **bin/arm-none-linux-gnueabihf-gdb**.

```cpp
user> bin/arm-none-linux-gnueabihf-gdb --version
GNU gdb (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.90.20220202-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
```

## Using Debugger <a href="#vos3_debugging_applications_using_debugger" id="vos3_debugging_applications_using_debugger"></a>

For remote debugging to work, gdbserver needs to be started on the terminal.

```cpp
$> gdbserver :22222 mybinary
Process /home/usr1/mybinary created; pid = 1137
Listening on port 22222
```

To attach to an already running process also gdbserver can be instrumented. To allow attaching to a process, this feature needs to be enabled first as root user.

```cpp
#> echo 0 > /proc/sys/kernel/yama/ptrace_scope
$> gdbserver :22222 --attach $(pidof mybinary)
Attached; pid = 1162
Listening on port 22222
```

From the developers PC gdb can now be configured to connect to this gdbserver instance.

```cpp
user> /opt/vos3/bin/arm-none-linux-gnueabihf-gdb -q mybinary-debug
Reading symbols from mybinary-debug...
(gdb) target remote <terminal-ip-here>:22222
Remote debugging using <terminal-ip-here>:22222
Reading symbols from /opt/vos3/arm-none-linux-gnueabihf/libc/lib/ld-linux-armhf.so.3...
0xb6fdd8d4 in ?? () from /opt/vos3/arm-none-linux-gnueabihf/libc/lib/ld-linux-armhf.so.3
(gdb) b main
Breakpoint 1 at 0x11d2a: file main.cpp, line 5.
(gdb) c
Continuing.
Breakpoint 1, main (argc=1, argv=0xbefffe84) at main.cpp:5
5 int main(int argc, char **argv) {
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/readme/developing_applications/pg_vos3_debugging_applications.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
