Ubuntu 20.04: Debug package with debug symbol

04日 8月 2021

Ubuntu provides debug symbol as dbgsym package. This article will describe installing dbgsym and debugging package.

1 Add repository of dbgsym

#!/bin/sh -eU=http://ddebs.ubuntu.comC=$(lsb_release -cs)cat <<EOF | sudo tee /etc/apt/sources.list.d/ddebs.listdeb ${U} ${C} main restricted universe multiverse#deb ${U} ${C}-security main restricted universe multiversedeb ${U} ${C}-updates main restricted universe multiversedeb ${U} ${C}-proposed main restricted universe multiverseEOFwget -O – http://ddebs.ubuntu.com/dbgsym-release-key.asc | sudo apt-key add -sudo apt update -y

2 Install dbgsym package

Install <pkgname>-dbgsym.

$ sudo apt install -y bash-dbgsym

Download source code in order to this.

$ mkdir bash$ cd bash$ apt source bash

Install GDB and run it.

$ sudo apt install -y gdb

The directory command specifies top directory of source code.

(gdb) directory bash-5.0Source directories searched: /home/hiroom2/bash/bash-5.0:$cdir:$cwd(gdb) b mainBreakpoint 1 at 0x2ebd0: file .././shell.c, line 364.(gdb) rStarting program: /usr/bin/bashBreakpoint 1, main (argc=1, argv=0x7fffffffe188, env=0x7fffffffe198) at.././shell.c:364364 {

If you run only GDB, la src command is useful to track program.


]]> tagPlaceholderカテゴリ: en, debuginfo, ubuntu-2004

Android | Linux | SDL - Narrow Escape