Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix gdb on archlinux based distros
Something is VERY VERY broken with this gdb. Don't care, let's use our precompiled GDB (from binary mode) in the mean time!
  • Loading branch information
JustTNE committed Feb 11, 2021
1 parent 8f33d77 commit 7bdb0d3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
7 changes: 6 additions & 1 deletion attach
Expand Up @@ -35,7 +35,12 @@ cp "bin/libcathook.so" "$FILENAME"

echo loading "$FILENAME" to "$proc"

gdb -n -q -batch \
gdbbin="gdb"
if [ -x "./bin/gdb-arch-2021-02" ]; then
gdbbin="./bin/gdb-arch-2021-02"
fi

$gdbbin -n -q -batch \
-ex "attach $proc" \
-ex "echo \033[1mCalling dlopen\033[0m\n" \
-ex "call ((void*(*)(const char*, int))dlopen)(\"$FILENAME\", 1)" \
Expand Down
7 changes: 6 additions & 1 deletion attach-gdb
Expand Up @@ -35,7 +35,12 @@ cp "bin/libcathook.so" "$FILENAME"

echo loading "$FILENAME" to "$proc"

gdb -n -q -batch \
gdbbin="gdb"
if [ -x "./bin/gdb-arch-2021-02" ]; then
gdbbin="./bin/gdb-arch-2021-02"
fi

$gdbbin -n -q -batch \
-ex "attach $proc" \
-ex "echo \033[1mCalling dlopen\033[0m\n" \
-ex "call ((void*(*)(const char*, int))dlopen)(\"$FILENAME\", 1)" \
Expand Down
7 changes: 6 additions & 1 deletion attach-libnamed.sh
Expand Up @@ -44,7 +44,12 @@ sudo cp "bin/libcathook.so" "/lib/i386-linux-gnu/${FILENAME}"

echo loading "$FILENAME" to "$proc"

gdb -n -q -batch \
gdbbin="gdb"
if [ -x "./bin/gdb-arch-2021-02" ]; then
gdbbin="./bin/gdb-arch-2021-02"
fi

$gdbbin -n -q -batch \
-ex "attach $proc" \
-ex "echo \033[1mCalling dlopen\033[0m\n" \
-ex "call ((void*(*)(const char*, int))dlopen)(\"/lib/i386-linux-gnu/$FILENAME\", 1)" \
Expand Down
2 changes: 2 additions & 0 deletions scripts/dependencycheck
Expand Up @@ -97,6 +97,8 @@ case "$OS" in
requestPermissions "${arch_packages[@]}"
$SUDO pacman -S --noconfirm --needed "${arch_packages[@]}"
fi
# Arch's shipped GDB is broken at this time
curl -C - -o ./bin/gdb-arch-2021-02 https://nullworks.gitlab.io/cathook/cathook/gdb && chmod +x ./bin/gdb-arch-2021-02 || true
;;
"ubuntu")
dpkg -s "${ubuntu_packages[@]}" > /dev/null 2>&1
Expand Down

0 comments on commit 7bdb0d3

Please sign in to comment.