Simplified doc-site generation
[AGL/documentation.git] / docs / ATTIC / 3_Developer_Guides / 4_X(cross)_Development_System:_User's_Guide / 3_Debugging_Your_First_AGL_Application / 3.4.3.3_Using_the_Command_Line.md
1 ---
2 edit_link: ''
3 title: Using the Command Line
4 origin_url: >-
5   https://git.automotivelinux.org/src/xds/xds-docs/plain/docs/part-1/debug-cmd-line.md?h=master
6 ---
7
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/devguides/master/xds-docs-guides-devguides-book.yml -->
9
10 # Using the XDS Command Line
11
12 You can debug your AGL application using the XDS command line
13 in XDS remote mode or in native mode.
14
15 ## XDS Remote Mode
16
17 XDS remote debugging is the default mode for using XDS to debug your
18 application.
19
20
21 Follow this procedure to use XDS remotely to debug your application:
22
23 1. Declare the project you want to debug to the `xds-server`.
24    The project can also have been built using XDS.
25    See the "[Create your first AGL application](../../../#create-your-first-agl-application)"
26    topic for more details.
27
28 2. Be sure you have the XDS agent and XDS server chain in place.
29    You can find more information on this chain in the
30    "[Installing XDS](../../../#installing-xds)" topic.
31
32 3. Determine the unique project and SDK ID values.
33    Two methods exist for you to locate these ID values:
34
35    - Use the "Project" page of the XDS dashboard.
36
37    - Use the `xds-gdb --list` command from the XDS command line.
38      This command returns the list of all existing project and SDK
39      IDs:
40
41      ```bash
42      xds-gdb --list
43      ```
44
45 4. Define the `XDS_PROJECT_ID` and `XDS_SDK_ID` variables.
46    Defining these variables refers the project to the
47    `xds-server`.
48    Once you refer the project, you are ready to use `xds-gdb`
49    (e.g. cross debug your project).
50
51 5. Build and debug the project.
52
53 **Example**
54
55 Following is an example that builds and debugs a project
56 based on a CMakefile and the
57 [cmake-apps-module](https://git.automotivelinux.org/src/cmake-apps-module/):
58
59 ```bash
60 # Go into your project directory (e.g. helloworld-native-application)
61 cd ~/xds-workspace
62 # Clone the project files into your local directory.
63 git clone https://github.com/iotbzh/helloworld-native-application.git
64 # Go to the local project's directory.
65 cd helloworld-service
66
67 # Declare your project on xds-server
68 # For now, you can only do this step using the XDS Dashboard.
69 # See the "Build Using the XDS Dashboard" topic in the "Create Your
70 # First Application" topic.
71
72 # Define XDS configuration variables by creating a "xds-config.env" file.
73 cat <<EOF >./xds-config.env
74 #optional if not default value: XDS_AGENT_URL=http://localhost:8800
75 XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject
76 XDS_SDK_ID=poky-agl_aarch64_4.0.1
77 EOF
78
79 # Define the configuration file to use.
80 export XDS_CONFIG=../xds-gen3.conf
81
82 # Create a new build directory.
83 mkdir build && cd build
84
85 # Start remote cross-build
86 xds-cli exec -- cmake -DRSYNC_TARGET=root@myTarget ..
87 xds-cli exec -- make
88 xds-cli exec -- make remote-target-populate
89
90 # Start debugging
91 xds-gdb -x target/gdb-on-root@myTarget.ini
92 ```
93
94 <!-- section-note -->
95 **NOTE:**
96
97 The [helloworld-native-application](https://github.com/iotbzh/helloworld-native-application)
98 project is an AGL project based on the
99 [cmake-apps-module](https://git.automotivelinux.org/src/cmake-apps-module/).
100 For information on installing this module, see the
101 "[Installing the CMAKE Templates](../../cmakeafbtemplates/dev_guide/installing-cmake.html))"
102 topic.
103
104 The CMake templates that are used to develop applications
105 with the AGL Application Framework, automatically generate
106 Makefile rules (e.g. `remote-target-populate`) or scripts
107 (e.g. `build/target/*`).
108
109 For more info about the CMake templates, see the
110 "[Using the Cmake Applications Module](../../../#using-the-cmake-applications-module)"
111 topic.
112 <!-- end-section-note -->
113
114 ## Native debugging
115
116 Native debugging is best for applications or services that are also
117 built natively and you want to use any debugger (e.g. GDB) on an actual
118 piece of hardware.
119
120 To enable native debugging mode, set the `XDS_NATIVE_GDB` variable.
121
122 For information on debugging with GDB, see
123 "[Debugging with GDB](https://www.sourceware.org/gdb/onlinedocs/gdb.html)".