update ./attach
i haven't tested this but i just copy and pasted ./attach-backtrace and put the gdb line from ./attach in it so
This commit is contained in:
parent
ab0e04bd95
commit
eb3b38f9b8
15
attach
15
attach
@ -17,21 +17,24 @@ if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo Running instances: ${arr[@]}
|
||||
echo Attaching to ${arr[$1]}
|
||||
proc=${arr[$inst]}
|
||||
|
||||
if grep -q $(realpath bin/libcathook.so) /proc/${arr[$1]}/maps; then
|
||||
echo Running instances: ${arr[@]}
|
||||
echo Attaching to $proc
|
||||
|
||||
sudo ./detach $inst bin/libcathook.so
|
||||
|
||||
if grep -q $(realpath bin/libcathook.so) /proc/$proc/maps; then
|
||||
echo already loaded
|
||||
exit
|
||||
fi
|
||||
|
||||
echo loading $(realpath bin/libcathook.so) to ${arr[$1]}
|
||||
echo loading $(realpath bin/libcathook.so) to $proc
|
||||
gdb -n -q -batch \
|
||||
-ex "attach ${arr[$1]}" \
|
||||
-ex "attach $proc" \
|
||||
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
|
||||
-ex "call \$dlopen(\"$(realpath bin/libcathook.so)\", 1)" \
|
||||
-ex "call dlerror()" \
|
||||
-ex 'print (char *) $2' \
|
||||
-ex "detach" \
|
||||
-ex "quit"
|
||||
|
||||
|
Reference in New Issue
Block a user