Looks like breakpoints aren't working? https://paste.debian.net/1314501/ On Thu, Apr 18, 2024 at 3:52 PM Josh Marshall <joshua.r.marshall.1991@xxxxxxxxx> wrote: > > Looks like there are some fiddly bits about configuring the kernel. > Practically speaking, configuration needs to first be done within the > VM, then everything can be moved and compiled outside of it. > > How do I submit a final writeup to put somewhere? > > On Thu, Apr 18, 2024 at 3:27 PM Josh Marshall > <joshua.r.marshall.1991@xxxxxxxxx> wrote: > > > > There's a type already. Term 1 should be: > > > > qemu-system-x86_64 -s -cpu host -nographic -accel kvm -m 1G -kernel > > arch/x86/boot/bzImage -append "root=/dev/sdb3 rw > > console=ttyS0,115200n8" -drive > > format=qcow2,file=$HOME/Downloads/Arch-Linux-x86_64-basic.qcow2 > > > > However, the kernel panics because it can't mount the root FS on an > > unknown block. I don't know what the cause is. However, the UUIDs > > are scrambled from what are in GRUB. Is there some sort of security > > going on here? > > > > On Thu, Apr 18, 2024 at 3:15 PM Josh Marshall > > <joshua.r.marshall.1991@xxxxxxxxx> wrote: > > > > > > So the final outline would look like the following? > > > > > > Source: > > > https://github.com/archlinux/arch-boxes > > > > > > setup: > > > > > > git clone $LINUX_REPO & > > > wget https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-basic.qcow2 > > > > > > echo add-auto-load-safe-path > > > “$LINUX_REPO_PATH/scripts/gdb/vmlinux-gdb.py” >> > > > "$HOME/.config/gdb/gdbinit" > > > > > > echo ‘export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1’ >> $HOME/.bashrc > > > echo ‘export USERCFLAGS=" -ggdb "’ >> $HOME/.bashrc > > > > > > push $LINUX_REPO_PATH > > > > > > echo “CONFIG_SATA_AHCI=y” >> .config > > > echo “CONFIG_DEBUG_INFO=y” >> .config > > > echo “CONFIG_DEBUG_INFO_DWARF5=y” >> .config > > > echo “CONFIG_GDB_SCRIPTS=y” >> .config > > > echo “CONFIG_GDB_INFO_REDUCED=n” >> .config > > > echo “CONFIG_KGDB=y” >> .config > > > echo “CONFIG_FRAME_POINTER=y” >> .config > > > echo “CONFIG_KVM_GUEST=y” >> .config > > > echo “CONFIG_RANDOMIZE_BASE=n” >> .config > > > > > > make localyesconfig > > > pop > > > > > > source $HOME/.bashrc > > > mkdir -p $HOME/mnt/arch > > > > > > Iterate: > > > guestmount -w -a $HOME/Downloads/Arch-Linux-x86_64-basic.qcow2 -m > > > /dev/sda3 ~/mnt/arch/ > > > <copy sources, files, perform compilation steps, etc as needed to > > > inside the VM image as needed each development iteration> > > > umount ~/mnt/arch > > > > > > Term 1: > > > qemu-system-x86_64 -s -cpu host -nographic -accel kvm -m 1G -kernel > > > vmlinux2 -append "root=/dev/sda3 rw console=ttyS0,115200n8 nokaslr > > > " -drive format=qcow2,file=$HOME/Downloads/Arch-Linux-x86_64-basic.qcow2 > > > > > > Term 2: > > > gdb $LINUX_REPO_PATH/vmlinux > > > : target remote:1234 > > > <set break points> > > > : continue > > > > > > On Thu, Apr 18, 2024 at 11:36 AM ngn <ngn@xxxxxx> wrote: > > > > > > > > On Wed, Apr 17, 2024 at 05:18:34PM -0400, Josh Marshall wrote: > > > > > One issue I'm seeing is that gdb isn't seeing debugging symbols. I'm > > > > > getting the following output with the config linked. > > > > > > > > > > https://pastebin.com/tjq7QtQk > > > > > > > > > > ``` > > > > > anadon@botamon:~/Documents/code/linux$ gdb arch/x86/boot/bzImage > > > > > GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git > > > > > Copyright (C) 2024 Free Software Foundation, Inc. > > > > > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> > > > > > This is free software: you are free to change and redistribute it. > > > > > There is NO WARRANTY, to the extent permitted by law. > > > > > Type "show copying" and "show warranty" for details. > > > > > This GDB was configured as "x86_64-linux-gnu". > > > > > Type "show configuration" for configuration details. > > > > > For bug reporting instructions, please see: > > > > > <https://www.gnu.org/software/gdb/bugs/>. > > > > > Find the GDB manual and other documentation resources online at: > > > > > <http://www.gnu.org/software/gdb/documentation/>. > > > > > > > > > > For help, type "help". > > > > > Type "apropos word" to search for commands related to "word"... > > > > > Reading symbols from arch/x86/boot/bzImage... > > > > > (No debugging symbols found in arch/x86/boot/bzImage) > > > > > ``` > > > > > > > > > > > > > You should load vmlinux to the gdb, not the bzImage. bzImage is a > > > > compressed version of the kernel and its used boot, vmlinux is the > > > > static ELF binary that contains the debugging symbols.