Re: [patch] Add support for hooking prefix commands

Sorin Otescu
2011-03-09T12:54:52Z

On 03/09/2011 02:40 PM, Eli Zaretskii wrote:
>> Date: Wed, 09 Mar 2011 13:15:15 +0200
>> From: Sorin Otescu<sorinu@gmail.com>
>>
>> I recently needed to add a hook for the "info threads" command.
>> Unfortunately, this was not possible because GDB only allows hooking of
>> single word commands.
>> This patch adds support for multi-word command (prefix command) hooks.
>> In my case, the format of the hook commands is:
> Thanks.
>
>> define hook-info_threads
>> define hookpost-info_threads
> Can we have underscore characters in commands? If so, this
> implementation would defeat hooking them.
>
It is possible to define commands containing underscores, but none of
the built-in commands
contain any (they all use dash).
> Anyway, if this is accepted, please write a short patch for the manual
> as well.
>
The documentation for 7.2 suggests this functionality is already there;
the difference is that
you need to hook the last word of the command (in this case,
hook-threads). I wonder if
that's enough / better... This patch was generated from 7.0 and adapted
to 7.2.