freebsd-hackers Digest, Vol 305, Issue 6

Guillaume Ballet gballet at gmail.com
Tue Feb 3 05:32:24 PST 2009


On Sat, Jan 31, 2009 at 1:00 PM,  <freebsd-hackers-request at freebsd.org> wrote:
>
> Message: 4
> Date: Fri, 30 Jan 2009 09:41:58 -0800
> From: "Matthew Fleming" <matthew.fleming at isilon.com>
> Subject: Dynamic ddb commands
> To: <freebsd-hackers at freebsd.org>
> Message-ID: <1233337318.13748.101.camel at amaretto>
> Content-Type: text/plain;       charset="iso-8859-1"
>
> I'm working on BSD 6.x and of course the set of ddb commands is static
> to whatever is in the kernel at compile.  I see that BSD 7.1 has dynamic
> commands using sysinits and sysuninit's to call a new
> db_[un]register_cmd.
>
> I see this, though, only after I have spent a day or so adding a
> linker_file_[un]register_ddb() that works similarly to how sysinits are
> merged for the boot-time modules (malloc and copy pointers).  It seems
> to me that this solution (have the linker look for db_set and db_cmd_set
> and, if there are any entries, malloc and save pointers to commands) is
> more efficient in terms of space than adding a LIST to the command
> structure and then forcing sysinits to run.

This is what I proposed at first, you can find a patch doing just that
following that thread:
http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg65165.html

But Sam and John suggested to use the sysinit facility instead. I am
convinced they are right:
- Sysinits are a proven system, this is the least friction path. Also,
by adding functions to the linker you still have the (small but
existing) risk of adding bugs to that system.
- This require adding new sections. Now, on regular x86 machines that
doesn't seem too much of a problem. I am however currently working on
a port of FreeBSD to some ARM cortex-based board. When debugging using
JTAG, the smaller amount of sections whose location in physical memory
I have to care about, the simpler for me and those doing the same kind
of work.
- You are not "forcing" sysinits to run: they are run no matter what
when loading a module.
- You can still debug sysinits when inserting modules, as the core of
the debugger is already running and the list has been loaded in
memory. The modules command itself will of course not be available,
but the base commands will still be here.

Cheers,
Guillaume


More information about the freebsd-hackers mailing list