# Debug using GNU debugger By default, the build doesn't enable the GNU debugger (GDB). To enable GDB, do the following on the Linux host: 1. Go to the `layers/meta-qcom-hwe/recipes-devtools/packagegroups/` directory and open the `packagegroup-core-tools-debug.bbappend` file. 2. Change the `packagegroup-core-tools-debug.bbappend` file to add `gdb` in the package list. Skip this step if the package name is already in the package list. 3. Ensure that the build incorporates the debug symbols. readelf --debug-dump=decodedline Copy to clipboard Or objdump --syms | grep -i 'debug' Copy to clipboard If the debug symbols aren't enabled, compile all required executables or shared libraries with the `-g` compiler flag. To push debug symbols to the device, see [Configure debug symbols](https://docs.qualcomm.com/doc/80-70023-12/topic/debug_symbols.html#debug-symbols). 4. Recompile and flash the build on the device. To debug using GDB, run the following command on the device: gdb --pid 502 Copy to clipboard Sample output: > > > gdb: warning: Couldn't determine a path for the index cache directory. > GNU gdb (GDB) 11.2 > Copyright (C) 2022 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > Type "show copying" and "show warranty" for details. > This GDB was configured as "aarch64-qcom-linux". > Type "show configuration" for configuration details. > For bug reporting instructions, please see: > . > Find the GDB manual and other documentation resources online at: > . > For help, type "help". > Type "apropos word" to search for commands related to "word". > Attaching to process 502 > Reading symbols from /usr/bin/tqftpserv... > (No debugging symbols found in /usr/bin/tqftpserv) > Reading symbols from /usr/lib/libqrtr.so.1... > (No debugging symbols found in /usr/lib/libqrtr.so.1) > Reading symbols from /lib/libc.so.6... > Reading symbols from /lib/.debug/libc.so.6... > Reading symbols from /lib/ld-linux-aarch64.so.1... > Reading symbols from /lib/.debug/ld-linux-aarch64.so.1... > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/libthread_db.so.1". > 0x0000ffffab00ef34 in __GI___select (nfds=4, readfds=0xffffc2ec14f8, writefds=0x0, exceptfds=0x0, timeout=0x0) at ../sysdeps/unix/sysv/linux/select.c:69 > 69 ../sysdeps/unix/sysv/linux/select.c: No such file or directory. > (gdb) > (gdb) > (gdb) > (gdb) > Copy to clipboard The following table lists the commonly used GDB commands. Table: Common GDB commands | Command | Description | | --- | --- | | `(gdb) bt` | Provides a backtrace of the current thread. | | `(gdb) info threads` | Lists the IDs of currently known threads. | | `(gdb) thread 2` | Switches to thread 2. | | `(gdb) where` | Shows the current line number and the function you are in. | | `(gdb) thread apply all bt full` | Provides a backtrace of all threads. | | `(gdb) info sharedlibrary` | Lists the names of shared libraries used. | | `(gdb) info reg` | Lists the CPU registers. | For more information, see [Linux manual page](https://man7.org/linux/man-pages/man1/gdb.1.html). Last Published: Feb 12, 2026 [Previous Topic Debug using Valgrind](https://docs.qualcomm.com/bundle/publicresource/80-70023-12/topics/debug_using_valgrind.md) [Next Topic Collect coredump](https://docs.qualcomm.com/bundle/publicresource/80-70023-12/topics/collect_coredumps.md)