This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/3, doc RFA] gdbserver debug_printf+timestamps: main patch
- From: Doug Evans <dje at google dot com>
- To: Pedro Alves <palves at redhat dot com>, Yao Qi <yao at codesourcery dot com>, Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Thu, 16 Jan 2014 18:58:43 -0800
- Subject: Re: [PATCH 3/3, doc RFA] gdbserver debug_printf+timestamps: main patch
- Authentication-results: sourceware.org; auth=none
- References: <yjt2zjnztait dot fsf at ruffy dot mtv dot corp dot google dot com> <52B1842F dot 5020401 at redhat dot com> <21205 dot 55987 dot 69477 dot 892571 at ruffy dot mtv dot corp dot google dot com> <52D81569 dot 3080006 at redhat dot com> <CADPb22SK=YQeOcOdNPXERxXKOT2E64k=pHhw0GBiLj4LQhL-Ag at mail dot gmail dot com> <52D82AD5 dot 7000306 at redhat dot com> <21208 dot 27400 dot 695984 dot 88504 at ruffy dot mtv dot corp dot google dot com> <21208 dot 27945 dot 781450 dot 905336 at ruffy dot mtv dot corp dot google dot com>
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.