This is the mail archive of the gdb@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]
Other format: [Raw text]

consult before asking ER.


Hi All,

I'd like to consult with you gdb sources guru before asking for an enhancement
request, as I don't know if my request is valid or not.

I'd like to define 'user defined commands' called here user-functions for
which the name could be case sensitive.

The reason for this are multiple but one important for me is the ability to
define a set of function that mimic an older debuger I use to use (namely
xdb).

In this old debuger 's' and 'S' are not the same, and defining 'S' is vital
for me :-)



In top.c I see
  /* If the rest of the commands will be case insensitive, this one
     should behave in the same manner. */
  for (tem = comname; *tem; tem++)
    if (isupper (*tem))
      *tem = tolower (*tem);

This comment 'may be' mean the intent was to have the define case sensitive
based on debug language context, but sounds to despotically always downcase no
matter the 'if' sez.

I did try 
  if(case_sensitivity!=case_sensitive_on) <---- Added line
  for (tem = comname; *tem; tem++)
    if (isupper (*tem))
      *tem = tolower (*tem);


And this is enough to get the user-function case sensitive.


So my 1st question is:
----------------------

Does this little patch could be ledgitly be incorporated into the mainstream
or is there many side effect I don't envision?

Note that would make case non-sensitive context like fortran un-able to define
'S' and 's' but I admit I don't care. If we do care, we should do if(1)
instead of if(case_sensitivity!=case_sensitive_on)

====================================================================

Another one vital for me is teh ability to 'omit' args for user-function, for
instance I would like to define a function 'c' (like xdb 'c') like this

define c
  if $arg0
    until $arg0
  else
    continue
  end
end

Doing this right now and issuing the gdb command 'c' gives

(gdb) c
Missing argument 0 in user function.

This is anoying as doing variable args function is a command practice in many
languages.


In setup_user_args::top.c
.....
#if 0 <------------ commented out code 
  if (p == NULL)
    return old_chain;
#endif
  while (p&&*p)
    {
.....
    }
  while(arg_count<MAXUSERARGS) <------- Added code after the loop
  { user_args->a[arg_count].len = 1;
    user_args->a[arg_count].arg = (char *)xmalloc(2);
    user_args->a[arg_count].arg[0]='0';user_args->a[arg_count].arg[1]=0;
    arg_count++;
    user_args->count++;
  }
  return old_chain;
}


This tiny patch alow missing args to be setup with value "0" that is pretty
acceptable, unless you se undesirable side effect.

The main inconsistant things is that we don't distinguish true given '0' and
unset args, but I don't thinks it is a problem.

=======================================================================

Let me know if I should fill an enhancement request if you think this are
ledgit requests. 

Thanx in advance
Phi


--
mailto:Philippe_Benard@hp.com
WTEC HP-UX kernel debugging tools


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