[[dbg]]
=== Debugging information

The Debian package is built with the debugging information but packaged into the binary package after stripping the debugging information as required by https://www.debian.org/doc/debian-policy/#document-ch-files[Chapter 10 - Files] of the ``Debian Policy Manual''.

See

* https://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.html#bpp-dbg[6.7.9. Best practices for debug packages] of the ``Debian Developer's Reference''.
* https://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files[18.2 Debugging Information in Separate Files] of the ``Debugging with gdb''
* *dh_strip*(1)
* *strip*(1)
* *readelf*(1)
* *objcopy*(1)
* Debian wiki https://wiki.debian.org/DebugPackage[DebugPackage]
* Debian wiki https://wiki.debian.org/AutomaticDebugPackages[AutomaticDebugPackages]
* Debian debian-devel post: https://lists.debian.org/debian-devel/2015/08/msg00443.html[Status on automatic debug packages] (2015-08-15)

[[dbgsym]]
==== New -dbgsym package (Stretch 9.0 and after)

The debugging information is automatically packaged separately as the debug package using the *dh_strip* command with its default behavior.  The name of such a debug package normally has the *-dbgsym* suffix.

If there were no *-dbg* packages defined in the *debian/control* file, no special care is needed for updating the package after the Stretch 9.0 release.

* The *debian/rules* file shouldn't explicitly contain *dh_strip*.
* Set *debian/compat* to *11* or newer.
* Bump the *Build-Depends* to *debhelper (>=11~)* or newer. 

If there were *-dbg* packages defined in the *debian/control* file, following care is needed for updating the old package after the Stretch 9.0 release.

* Drop definition entries of such *-dbg* packages in the *debian/control* file.
* Replace ``*dh_strip --dbg-package=*'package''' with ``*dh_strip --dbgsym-migration=*'package''' in the *debian/rules* file to avoid file conflicts with the (now obsolete) *-dbg* package.  See *dh_strip*(1).
* Set *debian/compat* to *11* or newer.
* Bump the *Build-Depends* to *debhelper (>=11~)* or newer. 
