-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run gdb client in docker instead of host (#1616)
* run gdb client in docker instead of host this gives gdb access to the full source tree for debugging * Update gdb-server.sh * Update gdb-server.sh * Update gdb-client.sh
- Loading branch information
1 parent
f5152ea
commit 9399a22
Showing
2 changed files
with
28 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
#!/bin/bash | ||
a=`uname` | ||
if [[ "$a" == "Linux" ]]; then | ||
/usr/bin/gdb-multiarch -ex 'target remote :3333' ./spade.elf | ||
else | ||
/opt/homebrew/bin/arm-none-eabi-gdb -ex 'target remote :3333' ./spade.elf | ||
fi | ||
|
||
dependencies=("docker" "echo" "whoami" "grep") | ||
|
||
for dep in "${dependencies[@]}"; do | ||
if ! command -v $dep > /dev/null; then | ||
printf "%s not found, please install %s\n" "$dep" "$dep" | ||
exit 1 | ||
fi | ||
done | ||
|
||
echo "Dependencies found successfully" | ||
|
||
# Ensure user in docker group if on linux | ||
if id -nG $(whoami) | grep -qw "docker"; then | ||
echo User in docker group, continuing | ||
else | ||
if [[ $OSTYPE != *"linux"* ]]; then | ||
echo "Platform is not linux, skipping docker group check" | ||
else | ||
echo User $(whoami) not in the docker group. Please add user $(whoami) to the docker group and try again | ||
exit 1 | ||
fi | ||
fi | ||
|
||
case $1 in | ||
"--log") docker build ./docker | tee dockerBuildLog.txt | ||
docker run -it --security-opt label:disable --network host --rm --volume `pwd`:/root/spade $(docker images | awk '{print $3}' | awk 'NR==2') /usr/bin/gdb-multiarch -ex "target remote :3333" /root/spade/spade.elf | tee -a dockerBuildLog.txt ;; | ||
*) docker build ./docker | ||
docker run -it --security-opt label:disable --network host --rm --volume `pwd`:/root/spade $(docker images | awk '{print $3}' | awk 'NR==2') /usr/bin/gdb-multiarch -ex "target remote :3333" /root/spade/spade.elf ;; | ||
esac |