Re: [patch] Add support for hooking prefix commands

Sorin Otescu
2011-03-09T13:54:50Z

On 03/09/2011 03:39 PM, Eli Zaretskii wrote:
>> Date: Wed, 09 Mar 2011 14:54:44 +0200
>> From: Sorin Otescu<sorinu@gmail.com>
>> CC: gdb-patches@sourceware.org
>>
>>> 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).
> That could be a problem. What do others think?
>
>>> 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.
> Are you saying that 7.2 already supports this feature? Or are you
> saying that it's documented there, but doesn't work?
>
It's documented there, but I can't test it ATM, because I'm using a gdb
from a toolchain and it's not
easy for me to switch to 7.2. Maybe somebody can shed a light on the issue.
I see some problems with that approach, even if it works. What happens
if two or more commands
have the same second word ? Which one would be used ?