1#!/bin/bash
2#
3# Example script to always start debugging the first copy of the
4# kernel image when using the simulator. Also loads symbols of a
5# process.
6#
7# Copy this to your build directory and execute as:
8# make debugsim GDB_ARGS='-x `./debugsim.sh`'
9
10OUTPUT=debugsim.gdb
11
12get_section_start ()
13{
14	objdump -h $2 | awk "\$2 == \"$1\"{ print \$4 }"
15}
16
17cat > $OUTPUT <<EOF
18debug_kernel_at x86_64/sbin/cpu 0xffffff8004362000
19add-symbol-file x86_64/sbin/arrakismon 0x`get_section_start .text x86_64/sbin/arrakismon`
20info threads
21EOF
22
23echo $OUTPUT
24