AppImage / type2-runtime

The runtime is the executable part of every AppImage. It mounts the payload via FUSE and executes the entrypoint.
Other
22 stars 17 forks source link

Add GNU debug link to load debug symbols in gdb #67

Closed TheAssassin closed 3 months ago

TheAssassin commented 3 months ago

Along with the modifications to the strip call, this seems to fix the broken relationship between the two files. Also, one no longer needs to load the debug symbols manually.

Ideally, one can put the runtime.debug file in the same directory as the AppImage, then run gdb my.AppImage.

Changes inspired by https://invent.kde.org/packaging/craft/-/blob/7c627a015c72ea7da4177375729dfe21e1810755/bin/utils.py#L1305-1305.

Fixes #25.

TheAssassin commented 3 months ago

Before you ask, according to my tests, there is no noticeable size difference (680k vs. 680k). If there is any, it's negligible.

TheAssassin commented 3 months ago

Works like a charm:


> env LC_ALL=C gdb ./CPU-X-x86_64.AppImage
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./CPU-X-x86_64.AppImage...
Reading symbols from .../runtime-x86_64.debug...
(gdb) b appimage_get_elf_size
Breakpoint 1 at 0x41b74d
(gdb) r
Starting program: .../CPU-X-x86_64.AppImage 

Breakpoint 1, 0x000000000041b74d in appimage_get_elf_size ()
github-actions[bot] commented 3 months ago

Build for testing: artifacts Use at your own risk.

TheAssassin commented 3 months ago

There is a PR in the making that will change that stuff to use the main build script as well. I don't see a point in copying the code right now.

probonopd commented 3 months ago

Now the following lines are scattered across the script; are these all needed?

objcopy --only-keep-debug runtime runtime.debug
strip --strip-debug --strip-unneeded runtime
objcopy --add-gnu-debuglink runtime runtime.debug
strip runtime
objcopy --add-gnu-debuglink runtime-"$architecture".debug runtime-"$architecture"
TheAssassin commented 3 months ago

Please don't randomly copy lines from various scripts. Again, the build process will be unified sooner than later and the old chroot code will go away anyway. I will not copy-paste code. That is going to produce unnecessary merge conflicts for no reason and the extra work is more than pointless.

probonopd commented 3 months ago

I am merely citing lines that are in this PR and am questioning whether all of these are needed (multiple invocations of the same tools). Let's at least document what each of those does.

TheAssassin commented 3 months ago

I see. Looks like I forgot to clean up two lines. My bad. Fixed.

github-actions[bot] commented 3 months ago

Build for testing: artifacts Use at your own risk.