Extending the ddb command set

Sam Leffler sam at freebsd.org
Sun Aug 17 18:23:33 UTC 2008


Guillaume Ballet wrote:
> On Sat, Aug 16, 2008 at 5:15 PM, Sam Leffler <sam at freebsd.org> wrote:
>   
>> Guillaume Ballet wrote:
>>     
>>> Hello hackers,
>>>
>>> I am currently working on a small project and would like to add a few
>>> commands to the set that is available in ddb.
>>>
>>> I found that very interesting albeit succinct presentation:
>>> http://people.freebsd.org/~jhb/papers/bsdcan/2008/slides.odp<http://people.freebsd.org/%7Ejhb/papers/bsdcan/2008/slides.odp>
>>>
>>> where the author hints that I should use DB_COMMAND, which I did. Yet when
>>> invoking ddb, the command does not appear in the help list. I have taken a
>>> look at the source code and was expecting set_db_cmd_set to appear in my
>>> module's section list when calling objdump -h
>>>
>>> Is DB_COMMAND only working within the kernel itself, and not modules?
>>>
>>>
>>>       
>> That is correct; you can't add ddb cmds from modules.  It should be doable; just hasn't been done yet.
>>
>>   Sam
>>
>>     
>
> It is indeed doable: Here are the diffs for a first attempt at doing
> this. I am not entirely satisfied with it, though, as it does not work
> with DB_SHOW_COMMAND and the likes... Also, I have to declare a lot of
> ddb-related stuff into kern_linker.c and I don't like it. I am
> currently working at improving the whole thing, but in the mean time
> if someone wants to give it a try, comments/rants would be greatly
> appreciated.
>
>   

Last I looked at this I was convinced it could be done using SYSINIT's 
and the existing mechanisms for adding ddb cmds.  I don't think you need 
to modify the linker or ddb.  Not sure if you looked sys/module.h and/or 
sys/kernel.h?

    Sam



More information about the freebsd-hackers mailing list