Skip to contentSkip to conversation

Debugging early ode under the simulator

Linux-ia64 Peter Chubb 2 participants 2 messages Nov 14, 2002

lore
Share & tools
lore
#0 lore raw

Hi,
There's no easy way to set breakpoints or watchpoints in the
kernel before the kernel starts running, when running under the SKI simulator.

One way to fix this is appended.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.814 -> 1.815
# arch/ia64/boot/bootloader.c 1.3 -> 1.4
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/11/14 [email protected] 1.815
# Add a debug breakpoint dummy function.
#
# When in the simulator, one cannot set a break point or watchpoint

# before the symbol table for the kernel is in memory, 
# and the kernel has set things up to run in a virtual addrs space.
# 
# Therefore, insert a dummy function here that one can set a breakpoint
# on, then single step a  few dozen times, then set up the 
# breakpoints one really wants.
# --------------------------------------------
#
diff -Nru a/arch/ia64/boot/bootloader.c b/arch/ia64/boot/bootloader.c
--- a/arch/ia64/boot/bootloader.c	Thu Nov 14 15:36:29 2002
+++ b/arch/ia64/boot/bootloader.c	Thu Nov 14 15:36:29 2002
@@ -53,6 +53,14 @@

#include "../kernel/fw-emu.c"

+/*
+ * Set a break point on this function so that
+ * symbols are available to set breakpoints in the
+ * kernel being debugged.
+ */
+void debug_break(void) {
+}
+
static void
cons_write (const char *buf)
{
@@ -187,6 +195,7 @@

ssc(0, (long) kpath, 0, 0, SSC_LOAD_SYMBOLS);

+ debug_break();
asm volatile ("mov sp=%2; mov r28=%1; br.sptk.few %0"
:: "b"(e_entry), "r"(bp), "r"(__pa(&stack)));

--
Dr Peter Chubb [email protected]
You are lost in a maze of BitKeeper repositories, all almost the same.

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Peter Chubb

Peter> Hi, There's no easy way to set breakpoints or watchpoints in Peter> the kernel before the kernel starts running, when running Peter> under the SKI simulator.

Peter> One way to fix this is appended.

I usually would just look for the indirect branch in _start(), but that's admittedly not the most obvious way to go about it. Your solution is easier for new users, so I applied a (slightly modified) version of it.

Thanks,

	--david