1#!/bin/sh 2 3########################################################################## 4# Copyright (c) 2007, 2008, 2009, ETH Zurich. 5# All rights reserved. 6# 7# This file is distributed under the terms in the attached LICENSE file. 8# If you do not find this file, copies can be found by writing to: 9# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 10########################################################################## 11 12# Generates a debug.gdb file that can be used to debug the Barrelfish kernel. 13 14KERNELPATH=$2 15 16OBJDUMP=${OBJDUMP:-no_objdump} 17 18get_section_start () 19{ 20 ${OBJDUMP} -h $KERNELPATH | awk "\$2 == \"$1\"{ print \$4 }" 21} 22 23TEXT_ADDR=`get_section_start .text` 24RODATA_ADDR=`get_section_start .rodata` 25DATA_ADDR=`get_section_start .data` 26DATA_REL_ADDR=`get_section_start .data.rel` 27DATA_REL_LOCAL_ADDR=`get_section_start .data.rel.local` 28BSS_ADDR=`get_section_start .bss` 29 30MULTIPLIER=0x400000 31 32sed -e "s,%KERNEL,$KERNELPATH, 33s/%text/0x$TEXT_ADDR/ 34s/%rodata/0x$RODATA_ADDR/ 35s/%data_rel_local/0x$DATA_REL_LOCAL_ADDR/ 36s/%data_rel/0x$DATA_REL_ADDR/ 37s/%data/0x$DATA_ADDR/ 38s/%bss/0x$BSS_ADDR/ 39s/%multiplier/$MULTIPLIER/" $1 40