mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
GEM5 gdb debug
Improve GEM5 documentation in general. Fix documentation for x86 kernel module debugging example, fop_write had been made static, and use timer.ko instead of fops which is more reliable and fun.
This commit is contained in:
23
rungdb
23
rungdb
@@ -4,8 +4,9 @@ set -e
|
||||
|
||||
arch='x86_64'
|
||||
bdfore=''
|
||||
gem5=false
|
||||
kgdb=false
|
||||
while getopts A:a:b:k OPT; do
|
||||
while getopts A:a:b:gk OPT; do
|
||||
case "$OPT" in
|
||||
a)
|
||||
arch="$OPTARG"
|
||||
@@ -16,6 +17,9 @@ while getopts A:a:b:k OPT; do
|
||||
b)
|
||||
before="$OPTARG"
|
||||
;;
|
||||
g)
|
||||
gem5=true
|
||||
;;
|
||||
k)
|
||||
kgdb=true
|
||||
;;
|
||||
@@ -28,8 +32,15 @@ if [ "$#" -gt 0 ]; then
|
||||
else
|
||||
brk=''
|
||||
fi
|
||||
if "$gem5"; then
|
||||
arch_dir="${arch}-gem5"
|
||||
port=7000
|
||||
else
|
||||
arch_dir="$arch"
|
||||
port=1234
|
||||
fi
|
||||
|
||||
buildroot_out_dir="$(pwd)/buildroot/output.${arch}~"
|
||||
buildroot_out_dir="$(pwd)/buildroot/output.${arch_dir}~"
|
||||
gdb="${buildroot_out_dir}/host/usr/bin/${arch}-linux-gdb $before"
|
||||
cd "${buildroot_out_dir}/build/linux-custom/"
|
||||
if "$kgdb"; then
|
||||
@@ -37,7 +48,7 @@ if "$kgdb"; then
|
||||
-q \
|
||||
-ex 'add-auto-load-safe-path $(pwd)' \
|
||||
-ex 'file vmlinux' \
|
||||
-ex 'target remote localhost:1234'
|
||||
-ex 'target remote localhost:$port'
|
||||
"
|
||||
else
|
||||
case "$arch" in
|
||||
@@ -47,12 +58,12 @@ else
|
||||
-ex 'add-auto-load-safe-path $(pwd)' \
|
||||
-ex 'file vmlinux' \
|
||||
-ex 'set arch i386:x86-64:intel' \
|
||||
-ex 'target remote localhost:1234' \
|
||||
-ex 'target remote localhost:$port' \
|
||||
$brk \
|
||||
-ex 'continue' \
|
||||
-ex 'disconnect' \
|
||||
-ex 'set arch i386:x86-64' \
|
||||
-ex 'target remote localhost:1234' \
|
||||
-ex 'target remote localhost:$port' \
|
||||
-ex 'lx-symbols ../kernel_module-1.0/' \
|
||||
"
|
||||
;;
|
||||
@@ -61,7 +72,7 @@ $brk \
|
||||
-q \
|
||||
-ex 'add-auto-load-safe-path $(pwd)' \
|
||||
-ex 'file vmlinux' \
|
||||
-ex 'target remote localhost:1234' \
|
||||
-ex 'target remote localhost:$port' \
|
||||
-ex 'lx-symbols ../kernel_module-1.0/' \
|
||||
$brk \
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user