This is the mail archive of the gdb-patches@sourceware.org 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: [PATCH 3/3, doc RFA] gdbserver debug_printf+timestamps: main patch


On Thu, Jan 16, 2014 at 3:37 PM, Doug Evans <dje@google.com> wrote:
> [...]
> @@ -2710,6 +2713,43 @@ handle_status (char *own_buf)
>      }
>  }
>
> +/* Parse options to --debug.
> +   ARG is either "--debug" or "--debug=foo".
> +   The result is zero if all options were parsed ok, otherwise
> +   (e.g., an option is misspelled) an error message is printed and
> +   non-zero is returned .  */
> +
> +static int
> +parse_debug_options (const char *arg)
> +{
> +  VEC (char_ptr) *options;
> +  int ix;
> +  char *option;
> +
> +  /* This is always implicit.  */
> +  debug_threads = 1;
> +
> +  if (strcmp (arg, "--debug") == 0)
> +    return 0;
> +  gdb_assert (strncmp (arg, "--debug=", sizeof ("--debug=") - 1) == 0);
> +
> +  options = delim_string_to_char_ptr_vec (arg + sizeof ("--debug=") - 1, ',');
> +
> +  for (ix = 0; VEC_iterate (char_ptr, options, ix, option); ++ix)
> +    {
> +      if (strcmp (option, "timestamp") == 0)
> +       debug_timestamp = 1;
> +      else
> +       {
> +         fprintf (stderr, "Unknown --debug argument: \"%s\"\n", option);
> +         return 1;
> +       }
> +    }
> +
> +  free_char_ptr_vec (options);
> +  return 0;
> +}

Blech, something's been nagging at me and sure enough ...
Silly memory leak (harmless, but still ...).
Will be fixed for checkin.


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