launch_gdb

This commit is contained in:
2022-07-13 18:26:33 +01:00
parent cf4cf216b0
commit dbe0701019

37
san
View File

@@ -58,6 +58,7 @@ disable_wd()
{ {
sh -c "while true ; do noreset; sleep 5; done" & sh -c "while true ; do noreset; sleep 5; done" &
} }
################################################################################ ################################################################################
# #
# Firmware flash. # Firmware flash.
@@ -183,23 +184,41 @@ setup_gdb()
# This is to allow fastboot to umount /nvram # This is to allow fastboot to umount /nvram
cat > /nvram/launch_gdb.sh << EOF cat > /nvram/launch_gdb.sh << EOF
#!/bin/sh #!/bin/sh
cp -r /nvram/tools /tmp/tools2
#export APIB_GDBSERVER="/tmp/tools2/strace -f" #export APIB_GDBSERVER="/tmp/tools2/strace -f"
#export APIB_GDBSERVER="/tmp/tools2/gdbserver :5555"
export APP_GDBSERVER="/tmp/tools2/gdbserver :5555"
#/tmp/tools2/gdbserver :5557 --attach \$(pgrep ZipMountServer)
#no watch dog
export appargs="-nowd"
# sh -c "while true ; do noreset; sleep 5; done"
EOF EOF
} }
descr " launch_gdb [seconds|app|zipmountserver|apibroker|apitrace]"
launch_gdb()
{
cp -r /nvram/tools /tmp/tools2
export appargs="-nowd"
if [ "$1" == "" ]; then
delay = 5
elif [ "$1" == "apibroker" ]; then
export APIB_GDBSERVER="/tmp/tools2/gdbserver :5555"
elif [ "$1" == "apitrace" ]; then
export APIB_GDBSERVER="/tmp/tools2/strace -f"
elif [ "$1" == "app" ]; then
export APP_GDBSERVER="/tmp/tools2/gdbserver :5555"
elif [ "$1" == "zipmountserver" ]; then
/tmp/tools2/gdbserver :5557 --attach $(pgrep ZipMountServer)
else
delay = $1
fi
if [ $delay != 0 ]; then
sh -c "while true; do apid=\$(pgrep Application); [ \$? == 0 ] && break; done; echo \$apid; sleep $1; /tmp/tools2/gdbserver :5555 --attach \$apid " &
fi
}
descr " enable_gdb - " descr " enable_gdb - "
enable_gdb() enable_gdb()
{ {
grep launch_gdb.sh /nvram/autostart > /dev/null grep launch_gdb /nvram/autostart > /dev/null
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "source /nvram/launch_gdb.sh" >> /nvram/autostart echo "launch_gdb 5" >> /nvram/autostart
fi fi
} }