Antoine Martin wrote:
>> for me I just do
>> #gdb um/vmlinux (was compiled with -O um)
>> gdb>run ubd0=/var/opt/FedoraCore5-AMD64-root_fs eth0=tuntap,,,192.168.0.117
>> after first trap in gdb
>> gdb>handle SIGUSR1 pass nostop noprint
>> from than on its strait gdb, tell me if you need a script for loading 
>> symbols of kernel modules.
>
> That would be great, it could go on the wiki too.
> 
> Thanks
> Antoine

Attach is a script that works for both uml running in gdb or for kgdb.
Usage: add-symbol-file module

Where module can be just the mod_name or mod_name.ko or a full-path

What you do is ssh into a running uml, after the module was loaded by the uml, 
and run the script.
The printed message is what you need to paste at the gdb command-line. (the 
first chance you get)
Note that the path echoed is relative to the uml root. You might need to adjust 
it for gdb since
gdb will see the host path. If the module is inside the root_fs file than you 
will need to point
gdb to a copy of the module file on the host.

I hope that helps
Boaz Harrosh
#!/bin/sh
#
# Print gdb command to load a module's symbols
#
# Copyright (C) 2006 Panasas, Inc.  All rights reserved.
# Copyright (C) 2006 Benny Halevy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# Usage: add-symbol-file module
#   module can be either the module name or path to the module object.
#
# Note: When used in UML, this script must run in UML's context in order
#       to access /sys/module/$mod/sections/.* to get the dynamic relocation
#       addresses but the module path must be valid in gdb's context so that
#       gdb can load the object.
#
progname=`basename $0`
mod=$1
if [ "$mod" = "" ]; then
        echo Usage: `$progname` module 1>&2
        exit 1
fi
if [[ -e "$mod" || "$mod" == */* ]]; then
        obj="$mod"
else
        rel=`uname -r`
        modpath="/lib/modules/$rel/kernel"
        obj=`find $modpath -name "$mod" -o -name "$mod.ko" -o -name "$mod.o" | 
head -1`
        if [ ! -e "$obj" ]; then
                echo "$progname: $mod was not found in $modpath" 1>&2
                exit 1
        fi
fi
mod=`basename $mod | sed 's/\..*o$//'`
dir=/sys/module/$mod/sections
if [ ! -d $dir ]; then
        echo "$progname: $dir not found" 1>&2
        exit 1
fi

s="`cat $dir/.text`"
for i in .rodata .data .bss; do
        s="$s -s $i `cat $dir/$i`"
done

echo "add-symbol-file $obj $s"
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to