Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jan 2009 10:29:36 -0800
From:      Sam Leffler <sam@freebsd.org>
To:        Matthew Fleming <matthew.fleming@isilon.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Dynamic ddb commands
Message-ID:  <49834710.9070908@freebsd.org>
In-Reply-To: <1233337318.13748.101.camel@amaretto>
References:  <1233337318.13748.101.camel@amaretto>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Fleming wrote:
> 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 haven't looked at your approach so not sure how to respond.  The 
existing code was simple.

> 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.
>
>   
If I recall it was painful to find entries in the help listing w/o sorting.

Feel free to propose an alternative implementation; noone's wed to 
what's in the tree.

    Sam




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