Skip to content
Snippets Groups Projects
Commit ba52bac8 authored by fu5520tp's avatar fu5520tp
Browse files

changed config and added info for gdb debugging

parent bd09eef9
No related branches found
No related tags found
No related merge requests found
...@@ -203,7 +203,7 @@ CONFIG_SYSFS_SYSCALL=y ...@@ -203,7 +203,7 @@ CONFIG_SYSFS_SYSCALL=y
# CONFIG_SYSCTL_SYSCALL is not set # CONFIG_SYSCTL_SYSCALL is not set
CONFIG_POSIX_TIMERS=y CONFIG_POSIX_TIMERS=y
CONFIG_KALLSYMS=y CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_ALL is not set CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y
CONFIG_KALLSYMS_BASE_RELATIVE=y CONFIG_KALLSYMS_BASE_RELATIVE=y
CONFIG_PRINTK=y CONFIG_PRINTK=y
...@@ -3770,7 +3770,11 @@ CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 ...@@ -3770,7 +3770,11 @@ CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# #
# Compile-time checks and compiler options # Compile-time checks and compiler options
# #
# CONFIG_DEBUG_INFO is not set CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_REDUCED is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
# CONFIG_DEBUG_INFO_DWARF4 is not set
CONFIG_GDB_SCRIPTS=y
# CONFIG_ENABLE_WARN_DEPRECATED is not set # CONFIG_ENABLE_WARN_DEPRECATED is not set
CONFIG_ENABLE_MUST_CHECK=y CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=2048 CONFIG_FRAME_WARN=2048
......
worker=8 worker=8
make -j"$worker" bzImage time make -j"$worker" bzImage
ln -sf scripts/gdb/vmlinux-gdb.py vmlinux-gdb.py # fix symlink for gdb
...@@ -22,3 +22,20 @@ cd /mnt ...@@ -22,3 +22,20 @@ cd /mnt
# run the build kernel with the created rootfs # run the build kernel with the created rootfs
run `./run_qemu.sh` run `./run_qemu.sh`
# debug using gdb
run `./run_qemu.sh gdb`
run in a seperate shell:
```bash
cd .. # to workspace root
gdb vmlinux \
-ex 'lx-symbols' \
-ex 'target remote :1234' \
-ex 'hb init_pb_rq'
```
look for gdb `add-auto-load-safe-path` warning and follow instruction to enable loading of kernel gdb scripts
use hardware breakpoints instead of software breaks
...@@ -9,7 +9,7 @@ COMMAND="qemu-system-x86_64" ...@@ -9,7 +9,7 @@ COMMAND="qemu-system-x86_64"
[ "$MODE" == "gdb" ] && COMMAND+=$DEBUG_OPTIONS [ "$MODE" == "gdb" ] && COMMAND+=$DEBUG_OPTIONS
COMMAND+=" -kernel $KERNEL -cpu host" COMMAND+=" -kernel $KERNEL -cpu host"
COMMAND+=$IMAGE_OPTIONS COMMAND+=$IMAGE_OPTIONS
COMMAND+=" -append \"root=/dev/sda rootwait rw single console=ttyS0\"" COMMAND+=" -append \"root=/dev/sda rootwait rw single console=ttyS0 nokaslr\"" # disable kaslr for better gdb debugging
COMMAND+=" --enable-kvm" COMMAND+=" --enable-kvm"
COMMAND+=" --nographic" COMMAND+=" --nographic"
COMMAND+=" --smp 1" COMMAND+=" --smp 1"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment