Failed kgdb ARM attempt

This commit is contained in:
Ciro Santilli
2017-05-28 11:09:37 +01:00
parent 1969cd6f8d
commit 54e55ec133
2 changed files with 11 additions and 3 deletions

View File

@@ -207,6 +207,7 @@ ARM TODOs:
- Ctrl + C kills the emulator, not sent to guest. See: - Ctrl + C kills the emulator, not sent to guest. See:
- <https://github.com/cloudius-systems/osv/issues/49> - <https://github.com/cloudius-systems/osv/issues/49>
- <https://unix.stackexchange.com/questions/167165/how-to-pass-ctrl-c-in-qemu> - <https://unix.stackexchange.com/questions/167165/how-to-pass-ctrl-c-in-qemu>
- GDB not connecting to KGDB. Possibly linked to `-serial stdio`.
## KGDB ## KGDB

13
runqemu
View File

@@ -5,6 +5,7 @@ set -e
# CLI handling. # CLI handling.
arch=x86_64 arch=x86_64
debug=false debug=false
kgdb=false
nographic=false nographic=false
extra_append='' extra_append=''
extra_flags='' extra_flags=''
@@ -19,10 +20,11 @@ while getopts a:dkn OPT; do
;; ;;
k) k)
debug=true debug=true
extra_append="$extra_append kgdbwait kgdboc=ttyS0,115200" extra_append="$extra_append kgdbwait"
# For those who want to try KDB. # For those who want to try KDB.
#extra_append="$extra_append kgdbwait kgdboc=kbd" #extra_append="$extra_append kgdbwait kgdboc=kbd"
extra_flags="$extra_flags -serial tcp::1234,server,nowait" extra_flags="$extra_flags -serial tcp::1234,server,nowait"
kgdb=true
;; ;;
n) n)
extra_append="$extra_append console=ttyS0" extra_append="$extra_append console=ttyS0"
@@ -35,6 +37,9 @@ done
images_dir='buildroot/output/images' images_dir='buildroot/output/images'
case "$arch" in case "$arch" in
x86_64) x86_64)
if $kgdb; then
extra_append="$extra_append kgdboc=ttyS0,115200"
fi
# If we turn on buildroot host QEMU some day. # If we turn on buildroot host QEMU some day.
#cmd="./buildroot/output/host/usr/bin/qemu-system-x86_64 \ #cmd="./buildroot/output/host/usr/bin/qemu-system-x86_64 \
cmd="qemu-system-x86_64 \ cmd="qemu-system-x86_64 \
@@ -50,9 +55,12 @@ case "$arch" in
" "
;; ;;
arm) arm)
if $kgdb; then
extra_append="$extra_append kgdboc=ttyAMA0,115200"
fi
cmd="qemu-system-arm \ cmd="qemu-system-arm \
-M versatilepb \ -M versatilepb \
-append 'root=/dev/sda console=ttyAMA0,115200' \ -append 'root=/dev/sda $extra_append' \
-drive file=${images_dir}/rootfs.ext2,if=scsi,format=raw \ -drive file=${images_dir}/rootfs.ext2,if=scsi,format=raw \
-dtb ${images_dir}/versatile-pb.dtb \ -dtb ${images_dir}/versatile-pb.dtb \
-kernel ${images_dir}/zImage \ -kernel ${images_dir}/zImage \
@@ -64,7 +72,6 @@ case "$arch" in
$extra_flags" $extra_flags"
;; ;;
esac esac
if "$debug" && ! "$nographic" && [ ! "$arch" = 'arm' ]; then if "$debug" && ! "$nographic" && [ ! "$arch" = 'arm' ]; then
eval "$cmd" &>/dev/null & eval "$cmd" &>/dev/null &
# TODO: Ctrl +C gets sent to QEMU? Why? Does not happen if I run # TODO: Ctrl +C gets sent to QEMU? Why? Does not happen if I run