This is the mail archive of the 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]

Re: [RFC 1/3] catch syscall -- try 6 -- Source-code modifications

> From: Sérgio_Durigan_Júnior <>
> Date: Thu, 10 Sep 2009 19:42:26 -0300
> Cc:
> > Could you perhaps expand the comment a bit more?  For example, what
> > should the target do if NEEDED is zero?  Also, I understand that
> > ANY_COUNT nonzero means TABLE should be ignored, is that right?
> > 
> > IOW, imagine that someone is to implement this method, and try to give
> > any information necessary to write the code.
> I tried to be more descriptive about this piece of code.  I also addressed
> your other message, fixing some wrong comments.  What do you think now?

It's fine, now the API is clear.  Thanks.

I have one more small request:

> +      /* Check if the user provided a syscall name or a number.  */
> +      syscall_number = (int) strtol (cur_name, &endptr, 10);

This forces the user to specify the system call numbers in decimal.
However, sometimes it might be more convenient to use hex.  For
example, I'm planning to add support for this to the DJGPP port, where
the various software interrupts and their functions are known to
people by their hex numbers, e.g. Interrupt 0x21 function 0x2a is the
DOS system call to get the system clock date.  Asking the users to
translate those into decimal would be a nuisance.

So can we use zero instead of 10 for the last argument of this call to

Finally, a minor nit:

> +  while (*arg != '\0')
> +    {
> +      int i, syscall_number;
> +      char *endptr;
> +      char cur_name[128];
> +      struct syscall s;
> +
> +      /* Skip whitespace.  */
> +      while (isspace (*arg))
> +        arg++;
> +
> +      for (i = 0; arg[i] && !isspace (arg[i]); ++i)
> +	cur_name[i] = arg[i];
> +      cur_name[i] = '\0';
> +      arg += i;

The last loop does not take care not to overrun the 128-character
limit that cur_name[] imposes on the length of syscall names, and will
happily smash the stack if GDB is fed a very long string.

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