Date: Tue, 8 Oct 2002 09:37:22 -0400 (EDT) From: Andrew Gallatin <gallatin@cs.duke.edu> To: Ian Dowse <iedowse@maths.tcd.ie> Cc: hackers@freebsd.org Subject: Re: gdb support for kernel modules Message-ID: <15778.57234.386016.42431@grasshopper.cs.duke.edu> In-Reply-To: <20021007234145.GC1408@hades.hell.gr> References: <200210071709.aa25499@salmon.maths.tcd.ie> <20021007234145.GC1408@hades.hell.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
Giorgos Keramidas writes: > On 2002-10-07 17:09, Ian Dowse <iedowse@maths.tcd.ie> wrote: > > > > This is something I have been meaning to investigate for a while: [...] > > Anyway, below is a proof-of-concept patch that does the basics, but > > among other things, its logic for locating the kernel module files > > needs a lot of work - currently it just assumes /boot/kernel/<module>, > > > diff -N solib-fbsd-kld.c > > --- /dev/null 1 Jan 1970 00:00:00 -0000 > > +++ solib-fbsd-kld.c 7 Oct 2002 10:39:48 -0000 > > > + snprintf (new->so_name, SO_NAME_MAX_PATH_SIZE, "/boot/kernel/%s", > > + new->so_original_name); > > I'm not really sure this would work for remote gdb sessions, but locally > it's probably more correct to use sysctl and grab the value of > kern.module_path or kern.bootfile instead of hardwiring `/boot/kernel/%s'. gdbmods does an ugly thing which is incredibly useful. It assumes that the modules you want to debug are sitting in your kernel build pool. So what it does is extract the build directory from the kernel (using strings), and runs a find rooted there for the module in question. But its a shell script, so it can get away with stuff like that ;) Perhaps we could embed the build directory somewhere the elf headers of each kernel module (including the kernel) so that kgdb could find the corresponding build file with symbols. Then your (very cool) solib-fbsd-kld.c could easily find the kernel and modules which match the kernel you're debugging.. Drew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15778.57234.386016.42431>