Subject: Re: ddb Upcoming enhancements/changes/history
To: John Hawkinson <jhawk@MIT.EDU>
From: Eduardo Horvath <eeh@turbolinux.com>
List: tech-kern
Date: 05/24/2000 10:00:30
On Wed, 24 May 2000, John Hawkinson wrote:

> >(I have had the pleasure of maintaining adb macros.  It's not viable
> >long-term unless the macros can be automatically generated.)
> 
> Err, isn't that Sun has:
> 
> [x15-cruise-basselope!jhawk] ~> /usr/lib/adb/adbgen -\?
> /usr/lib/adb/adbgen: illegal option -- ?
> adbgen [-d] [-m ilp32|lp64] [-w] <adb macro file>
> [x15-cruise-basselope!jhawk] ~> uname -a
> SunOS x15-cruise-basselope.mit.edu 5.7 Generic_106541-09 sun4u sparc SUNW,Ultra-5_10

I know.  Have you ever used adbgen?  It's a royal pain.  You may not need
to edit the adbgen script when fields move around, but you do need to edit
it whenever you add or delete fields from the structure.

My experience is that usually it's too much trouble to create a macro, and
even if one is created it's not properly maintained.

(2.7 kernels and beyond use a new program, `macrogen', which will generate
a complete macro from the header files and the structure name.  But you
still need to create a file for each structure and include all the
appropriate headers.  Creation is still an issue but maintenance costs go 
away.)

I think the easiest way to automagically generate macros would be to have
a utility that parses the debug symbols of the kernel and dumps out a set
of macros.  Otherwise you need to create a whole set of files to read in
headers in the correct order and get all the #defines right.  This is not
fun, and still doesn't give you access to any structures defined in .c
files.

Eduardo Horvath