Setting up for GDB Debugging

This guide describes how to set up the environment to debug webOS Open Source Edition (OSE) with GDB.


Before you begin setting up the environment for GDB debugging, you must:

  • Build the webOS OSE image as webos-image-devel. For more information, see here.

  • Flash the built image (.rpi-sdimg) to a microSD card and insert the microSD card in the target device. For more information, see here.

Booting up the Target

First, boot up the target device and make sure that processes run normally.

Downloading and Decompressing dbg Package

Even if the image has been built as webos-image-devel, it does not contain symbol or source code of each module that will be used for debugging. You should download the dbg package (.ipk) and decompress the package.

In this guide, we will use a process called event-monitor as an example. The target device is Raspberry Pi 3.

1. Copy the dbg package containing debug symbol of event-monitor, located under BUILD directory, to the target device.

$ cd ./BUILD/work/raspberrypi3-webos-linux-gnueabi/event-monitor/1.1.0-23-r2/deploy-ipks/raspberrypi3$
$ ls
$ scp event-monitor-dbg_1.1.0-23-r2_raspberrypi3.ipk root@[DEVICE_IP]:~/

2. On the target device, decompress the dbg package.

root@raspberrypi3:~# ls
root@raspberrypi3:~# ar x event-monitor-dbg_1.1.0-23-r2_raspberrypi3.ipk
root@raspberrypi3:~# tar xf data.tar.gz

After decompressing the dbg package, you can see the binary including debug symbols and the source code.

root@raspberrypi3:~# find usr

Running GDB

Run GDB by attaching to the running process.

root@raspberrypi3:~# pidof event-monitor
root@raspberrypi3:~# gdb /home/root/usr/sbin/.debug/event-monitor 953
GNU gdb (gdb) 7.11.1
---Type <return> to continue, or q <return> to quit---
0x76c85c0c in poll () from /lib/

You can look up the thread in use and print out the call stack.

(gdb) info threads
 Id Target Id Frame
* 1 Thread 0x76a0f0a0 (LWP 953) "event-monitor" 0x76c87c1c in po
ll () at ../sysdeps/unix/syscall-template.S:84

(gdb) bt
#0 0x76c87c1c in poll () at ../sysdeps/unix/syscall-template.S:84
#1 0x76ee1148 in ?? () from /usr/lib/
Backtrace stopped: previous frame identical to this frame (corrupt

By specifying the location of source code, you become fully prepared to debug webOS OSE with GDB.

(gdb) dir /home/root
Source directories searched: /home/root:$cdir:$cwd


Except as noted, this content is licensed under Creative Commons Attribution 4.0 and sample code is licensed under Apache License 2.0.