From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 30 17:53:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 898E41065674 for ; Fri, 30 Jan 2009 17:53:50 +0000 (UTC) (envelope-from matthew.fleming@isilon.com) Received: from seaxch09.isilon.com (seaxch09.isilon.com [74.85.160.25]) by mx1.freebsd.org (Postfix) with ESMTP id 694DF8FC18 for ; Fri, 30 Jan 2009 17:53:50 +0000 (UTC) (envelope-from matthew.fleming@isilon.com) X-MimeOLE: Produced By Microsoft Exchange V6.5 Received: from 10.54.190.89 ([10.54.190.89]) by seaxch09.desktop.isilon.com ([10.10.2.96]) with Microsoft Exchange Server HTTP-DAV ; Fri, 30 Jan 2009 17:41:50 +0000 MIME-Version: 1.0 Received: from amaretto by SEAXCH09.isilon.com; 30 Jan 2009 09:41:59 -0800 Organization: The Q Continuum X-Mailer: Evolution 2.24.2 Content-class: urn:content-classes:message Date: Fri, 30 Jan 2009 09:41:58 -0800 Message-ID: <1233337318.13748.101.camel@amaretto> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Dynamic ddb commands Thread-Index: AcmDAgfEVN4qhoMZRjucAuqo8gYrMQ== From: "Matthew Fleming" To: X-Mailman-Approved-At: Fri, 30 Jan 2009 18:08:33 +0000 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Dynamic ddb commands X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2009 17:53:50 -0000 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