take dust off from gdb

This commit is contained in:
2022-08-19 16:21:34 +01:00
parent 2d615ca7e4
commit 93ab7b3897

69
san
View File

@@ -3,7 +3,7 @@ set -o vi
# set -x # set -x
if [ -z $SAN_SERVER_IP ]; then if [ -z $SAN_SERVER_IP ]; then
SAN_SERVER_IP=10.23.135.17 SAN_SERVER_IP=192.168.0.64
fi fi
DESCR="" DESCR=""
@@ -11,6 +11,10 @@ descr(){
# echo "$1" # echo "$1"
DESCR="$DESCR\n$1" DESCR="$DESCR\n$1"
} }
header(){
descr ""
descr " * $1"
}
descr "Available Commands:" descr "Available Commands:"
descr " san_help - print this help." descr " san_help - print this help."
@@ -166,33 +170,32 @@ rokuflash()
# Ddd to the start of the script # Ddd to the start of the script
# export APP_GDBSERVER="/nvram/tools/gdbserver :5555"ebug Server # export APP_GDBSERVER="/nvram/tools/gdbserver :5555"ebug Server
# #
descr "" header "GDB"
descr " GDB" #descr " setup_gdb [seconds|app|zipmountserver|apibroker|apitrace]"
descr " setup_gdb - " #setup_gdb()
setup_gdb() #{
{ # #copy tools to /nvram folder for example:
#copy tools to /nvram folder for example: # cp -rL /tmp/tools /nvram/
cp -rL /tmp/tools /nvram/
#remount nvram with executable flag executable # #remount nvram with executable flag executable
# mount /nvram -o remount,exec # # mount /nvram -o remount,exec
#make nvram to preserve the exec flag after reboot: # #make nvram to preserve the exec flag after reboot:
# kdir /nvram/debug_overlay # # kdir /nvram/debug_overlay
# Create debug script, where we copy gdb back to tmp and run it from there. # # Create debug script, where we copy gdb back to tmp and run it from there.
# 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
#export APIB_GDBSERVER="/tmp/tools2/strace -f" ###export APIB_GDBSERVER="/tmp/tools2/strace -f"
EOF ##EOF
} #}
descr " launch_gdb [seconds|app|zipmountserver|apibroker|apitrace]"
launch_gdb() launch_gdb()
{ {
cp -r /nvram/tools /tmp/tools2 cp -r /nvram/tools /tmp/tools2
export appargs="-nowd" export appargs="-nowd"
local delay=0
if [ "$1" == "" ]; then if [ "$1" == "" ]; then
delay = 5 delay = 5
@@ -213,13 +216,19 @@ launch_gdb()
fi fi
} }
descr " enable_gdb - " descr " enable_gdb [seconds|app|zipmountserver|apibroker|apitrace]"
enable_gdb() enable_gdb()
{ {
grep launch_gdb /nvram/autostart > /dev/null [ ! -f /nvram/tools/gdbserver ] && cp -rL /tmp/tools /nvram/
if [ $? != 0 ]; then
echo "launch_gdb 5" >> /nvram/autostart [ -f /nvram/autostart ] && cat /nvram/autostart | sed '/launch_gdb/d' > /tmp/autostart
fi
local cmd="app"
[ "$1" != "" ] && cmd=$1
echo "launch_gdb $cmd" >> /tmp/autostart
rm /nvram/autostart
mv /tmp/autostart /nvram/
} }
descr " disable_gdb - " descr " disable_gdb - "
@@ -234,6 +243,7 @@ disable_gdb()
# #
# Log # Log
# #
header "LOG"
LOG_CONF="/nvram/logapi.conf" LOG_CONF="/nvram/logapi.conf"
descr " log_reset - reset log configuration" descr " log_reset - reset log configuration"
log_reset() log_reset()
@@ -259,6 +269,7 @@ log_seconds()
# #
# Config # Config
# #
header "Config"
descr " config_reset - erase configuration" descr " config_reset - erase configuration"
config_reset() config_reset()
{ {
@@ -293,8 +304,7 @@ disable_failsafe()
# Fastboot related # Fastboot related
# #
descr "" header "FastBoot"
descr " FastBoot"
descr " enable_fastboot - " descr " enable_fastboot - "
enable_fastboot() enable_fastboot()
{ {
@@ -334,8 +344,7 @@ fastboot_reset()
# #
# Wifi Setup # Wifi Setup
# #
descr "" header "WiFi"
descr " WiFi"
IFACE=wlan0 IFACE=wlan0
wpa() wpa()
{ {