Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jan 2009 09:41:58 -0800
From:      "Matthew Fleming" <matthew.fleming@isilon.com>
To:        <freebsd-hackers@freebsd.org>
Subject:   Dynamic ddb commands
Message-ID:  <1233337318.13748.101.camel@amaretto>

next in thread | raw e-mail | index | archive | help
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.

I'm curious as to why the current method was chosen when something
lighter-weight was available... or so it seems from my perspective
looking at the 6.x code base.

As another side note, lexicographic order for the commands doesn't seem
to add anything, except that command insert/delete are O(n/2) instead of
O(n).  It can make it harder to use ddb to debug ddb, though.  If, e.g.
there's a pointer problem somewhere in the command list, if the most
basic commands are up front like examine and write, then at least those
can be used to possibly repair ddb so a debug session can continue.

Just wondering things.

Thanks,
matthew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1233337318.13748.101.camel>