From nobody@FreeBSD.ORG Mon May 31 14:00:54 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id EDEC214A2E; Mon, 31 May 1999 14:00:53 -0700 (PDT)
Message-Id: <19990531210053.EDEC214A2E@hub.freebsd.org>
Date: Mon, 31 May 1999 14:00:53 -0700 (PDT)
From: aron@cs.rice.edu
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: kldload doesn't produce linker file upon loading a module
X-Send-Pr-Version: www-1.0

>Number:         11965
>Category:       kern
>Synopsis:       kldload doesn't produce linker file upon loading a module
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 31 14:10:00 PDT 1999
>Closed-Date:    Wed Jun 23 17:18:27 PDT 1999
>Last-Modified:  Wed Jun 23 17:20:04 PDT 1999
>Originator:     Mohit Aron
>Release:        FreeBSD-3.2-RELEASE
>Organization:
Rice University
>Environment:
FreeBSD luzern.cs.rice.edu 3.2-RELEASE FreeBSD 3.2-RELEASE #2: Fri May 28 15:22:48 CDT 1999     aron@luzern.cs.rice.edu:/usr/src/sys/compile/LUZERN  i386
>Description:
The modload command in the earlier lkm interface used to produce
a linker file as a result of the '-o' option. This file used to give
he actual addresses of variables in the module after loading it. This
information was very useful as then the values of variables in the 
module can be read by reading /dev/kmem. Unfortunately, kldload doesn't
produce any such file. Can a similar option be added to kldload so that
it too starts producing this linker file. 

Addresses of variables in the module can be obtained by adding the 
address where the module is loaded (reported by kldstat) to the 
address of the variable in the module (before relocation). However, this
is a cumbersome way and it'll much more convenient to have a linker file
that gives all this information.

I'm filing this under the "serious" category because I need this functionality
for any serious kernel debugging with modules.

>How-To-Repeat:
Load a kld module with kldload and notice that no linker file is produced. 
Load an lkm module with modload and a linker file is put in /tmp (unless
a '-o' option is given). 

>Fix:


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: msmith 
State-Changed-When: Wed Jun 23 17:18:27 PDT 1999 
State-Changed-Why:  

KLD by its very nature cannot and will never produce object files.  There has 
been some discussion of exporting a symbol table interface from the kernel 
for realtime access to symbol data, and it is possible to recover KLD load 
address information from a kernel core image.  Refer to grog@freebsd.org for 
details on this. 
>Unformatted:
