This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch to command hook (3rd time lucky) [Now under 79 wide].


> Date: Thu, 17 Aug 2000 12:04:27 +1000
> From: Steven Johnson <sbjohnson@ozemail.com.au>
>
> 4. Updated gdb.texinfo section on hooks to document "hookpost-" 
>    and "hookpre-".

Thanks for working on this.

The patches to gdb.texinfo are approved, provided that the following
comments are taken care of:

> + A @emph{hook} may also be defined which is run after the command you 

When introducing a new term, please use @dfn{}, not @emph{}.

> + executed. Whenever you run the command @samp{foo}, if the user-defined 

Please leave two spaces after a period that ends a sentence.  This
produces a much nicer results in the printed manual, and also makes
Emacs sentence-related commands DTRT.

Please also provide index entries for the hooks.  I suggest these:

  @cindex pre-command hooks
  @cindex post-command hooks
  @findex hookpre
  @findex hookpost

> + #define MAX_TMPBUF 128   
[snip]
> !   char tmpbuf[MAX_TMPBUF];
[snip]
> +       strncpy(tmpbuf,HOOK_PRE_STRING,MAX_TMPBUF);
> +       strncat(tmpbuf,comname+HOOK_LEN,MAX_TMPBUF-HOOK_PRE_LEN);

Why the arbitrary limitation on the length of the hook name?  Is the
user-defined command name length limited in GDB?  If so, MAX_TMPBUF
should be that limitation + sizeof("hookpost").  If there's no limit
on the length of a user-defined command, then I think the hooks should
not be limited, either.

> +       strncpy(tmpbuf,HOOK_STRING,MAX_TMPBUF);
> +       strncat(tmpbuf,comname+HOOK_PRE_LEN,MAX_TMPBUF-HOOK_LEN);
> +      
> +       tem2 = &tmpbuf[0];
> +      
> +       oldc = lookup_cmd (&tem2, cmdlist, "", -1, 1);
> + 
> +       if (oldc && STREQ (tmpbuf, oldc->name))
> +       { 
> +           error ("Can not define \"%s\"! \"%s\" has already been defined.", 
> +                comname, oldc->name);

Hmm...  So how does one redefine or undefine a hook for a command?
I'm probably missing something, but what?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]