-
Notifications
You must be signed in to change notification settings - Fork 3
/
Unload.sh
executable file
·46 lines (37 loc) · 1.31 KB
/
Unload.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Set the DEBUGGER variable on the cmdline to use lldb or any debugger
# Make sure it supports the following commands
DEBUGGER="${DEBUGGER:=gdb}"
echo "Using '$DEBUGGER' to uninject"
if ! [ -x "$(command -v $DEBUGGER)" ]; then
echo "$DEBUGGER does not exist"
echo "Install it or set the DEBUGGER variable to a replacement"
exit 1
fi
csgo_pid=$(pidof csgo_linux64)
if [ -z "$csgo_pid" ]; then
echo "CS:GO can't be found, is the game running?"
exit 1
fi
lib_name="lib$(cat ProjectName).so"
killall -19 steam
killall -19 steamwebhelper
$DEBUGGER -p "$csgo_pid" -n -q -batch \
-ex "set \$library = ((void*(*)(char*, int)) dlopen)(\"/usr/lib/$lib_name\", 6)" \
-ex "set \$dlclose = (int(*)(void*)) dlclose" \
-ex "call \$dlclose(\$library)" \
-ex "call \$dlclose(\$library)" 2>&1 || {
echo "A error has appeared"
echo "$DEBUGGER has failed to dlopen/dlclose the library"
if [ $DEBUGGER != "gdb" ]; then
echo "- Make sure that $DEBUGGER supports the same usage as GDB"
fi
echo "- A possible error could be this"
echo "https://github.com/LWSS/Fuzion/issues/621#issuecomment-777815272"
}
sleep 1
killall -18 steamwebhelper
killall -18 steam
echo "Process complete"
echo "If you face problems related to the unload process"
echo "you should provide the gdb session and build log to whoever is helping you."