aboutsummaryrefslogtreecommitdiffstats
path: root/docs/part-1/5-2_debug-first-app-cmd.md
blob: 8d0d76440874966f9efa16b0d2a526f980fa6c91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Debug using xds-gdb from command line

## XDS remote debugging mode

First the project you want to debug must be declared on an xds-server and this
project may also has been built using using XDS (see [Create your first AGL application](./4_build-first-app.html) for more details).

So to debug it you need to have the XDS agent - server chain in place and
you also need the project and sdk unique id.

You can find these IDs in project page of XDS dashboard or you can get them from command line using the `--list` option.

This option lists all existing projects ID:

```bash
xds-gdb --list
```

Now to refer your project, just set `XDS_PROJECT_ID` and `XDS_SDK_ID` variables.

You are now ready to use `xds-gdb` to for example cross debug your project.

Here is an example to build and debug a project based on CMakefile and
[AGL app-templates](https://git.automotivelinux.org/apps/app-templates/):

```bash
# Go into your project directory (for example helloworld-native-application)
cd ~/xds-workspace
git clone https://github.com/iotbzh/helloworld-native-application.git
cd helloworld-service

# Declare your project on xds-server
# <for now, you can only do this step using xds HTML dashboard (see xds-server doc)>

# Define XDS config
cat <<EOF >./xds-config.env
#optional if not default value: XDS_AGENT_URL=http://localhost:8800
XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject
XDS_SDK_ID=poky-agl_aarch64_4.0.1
EOF

# Tell to xds-cli and xds-gdb which is your config file
export XDS_CONFIG=../xds-gen3.conf

# Create a new build directory
mkdir build && cd build

# Start remote cross build
xds-cli exec -- cmake -DRSYNC_TARGET=root@myTarget ..
xds-cli exec -- make
xds-cli exec -- make remote-target-populate

# Start debugging
xds-gdb -x target/gdb-on-root@myTarget.ini
```

<!-- note -->
**Note:** : [helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) project is an AGL
project based on [app-templates](https://git.automotivelinux.org/apps/app-templates/)
(included as a git submodule). This CMake templating, used to develop application
with the AGL Application Framework, will automatically generate makefile rules
(eg. `remote-target-populate`) or scripts (eg. `build/target/xxx` scripts).

For more info about app-template, please refer to [this documentation](http://docs.automotivelinux.org/docs/devguides/en/dev/reference/sdk-devkit/docs/part-2/2_4-Use-app-templates.html).
<!-- endnote -->

## Native debugging

To enable native debugging mode, you need to define `XDS_NATIVE_GDB` variable.