Skip to content

Commit e1514af

Browse files
[gdb] wrap the wrapper
Main binary should not be deleted obvisouly but be called by this plugin
1 parent a1d87d1 commit e1514af

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

gdb/linuxdeploy-plugin-gdb.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ echo "Copying source files"
5858
cp --recursive $verbose "$LINUXDEPLOY_PLUGIN_GDB_SRC" "$appdir/usr/"
5959

6060
echo "Installing new AppRun wrapper"
61-
exe="$(readlink -f "$appdir/AppRun.wrapped")"
62-
rm $verbose "$appdir/AppRun.wrapped"
63-
cat > "$appdir/AppRun.wrapped" <<EOF
61+
# AppRun script does: exec "$this_dir"/AppRun.wrapped "$@"
62+
# AppRun.wrapped (this script) is a wrapper on AppRun.wrapped.orig
63+
# AppRun.wrapped.orig is the real application
64+
old_exe="$(readlink -f "$appdir/AppRun.wrapped")"
65+
new_exe="$old_exe.orig"
66+
mv $verbose "$old_exe" "$new_exe"
67+
cat > "$old_exe" <<EOF
6468
#! /bin/bash
6569
6670
if [[ -n "\$APPIMAGE_USE_GDB" ]]; then
67-
gdb --cd "\$APPDIR/usr/$(basename "$LINUXDEPLOY_PLUGIN_GDB_SRC")" --args "\$APPDIR/${exe#$appdir}" "\$@"
71+
gdb --cd "\$APPDIR/usr/$(basename "$LINUXDEPLOY_PLUGIN_GDB_SRC")" --args "\$APPDIR/${new_exe#$appdir}" "\$@"
6872
else
69-
exec "\$APPDIR/${exe#$appdir}" "\$@"
73+
exec "\$APPDIR/${new_exe#$appdir}" "\$@"
7074
fi
7175
EOF
72-
chmod $verbose 755 "$appdir/AppRun.wrapped"
76+
chmod $verbose 755 "$old_exe"

0 commit comments

Comments
 (0)