Skip to content

Commit

Permalink
解决了 空指针异常 Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aRLo077 committed Feb 12, 2025
1 parent 9b97fb2 commit 99358fe
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash

usage="
USAGE: $(basename "$0") [container] [-h]
where:
container: container id or container name
"

while getopts ':h' option; do
case "$option" in
*) echo "$usage" ;exit 0;;
esac
done

container=$1

if [[ -z "$container" ]]; then
echo -n "Container name (leave empty if stopped):"
read -r container < /dev/tty
fi

echo "Collecting, please wait..."

tmp_dir=$(mktemp -d -t redroid-debug.XXXXXXXX)
#echo "creating tmp dir: $tmp_dir"

cd "$tmp_dir" || exit 1

{ cp /boot/config-"$(uname -r)" ./ || zcat /proc/config.gz > config-"$(uname -r)"; } &> /dev/null

{ grep binder /proc/filesystems; grep ashmem /proc/misc; } > drivers.txt

uname -a &> uname.txt

lscpu &> lscpu.txt

getenforce &> getenforce.txt

{
lshw -C display
ls -al /dev/dri/
cat /sys/kernel/debug/dri/*/name;
} &> dri.txt

dmesg -T > dmesg.txt

docker info &> docker-info.txt

if [[ -n $container ]]; then
docker exec "$container" ps -A &> ps.txt
docker exec "$container" logcat -d &> logcat.txt
docker exec "$container" logcat -d -b crash &> crash.txt
docker exec "$container" /vendor/bin/vainfo -a &> vainfo.txt
docker exec "$container" getprop &> getprop.txt
docker exec "$container" dumpsys &> dumpsys.txt

<<'EOF' >network.txt docker exec -i "$container" sh
echo "************** ip a"
ip a
echo "************** ip rule"
ip rule
echo;echo "************** ip r show table eth0"
ip r list table eth0
EOF
docker container inspect "$container" &> container-inspect.txt
docker image inspect "$(docker container inspect -f '{{.Config.Image}}' "$container")" &> image-inspect.txt
fi

tmp_tar=${tmp_dir}.tgz
tar czf "$tmp_tar" "$tmp_dir" &> /dev/null

echo
echo "==================================="
echo "Please provide the collected logs"
echo "(zh_CN) 请提供此处收集的日志"
echo "${tmp_tar}"
echo "==================================="

0 comments on commit 99358fe

Please sign in to comment.