Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: "gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [patch][python] 2 of 5 - Frame filter MI code changes.
Date: Tue, 12 Mar 2013 20:43:00 -0000	[thread overview]
Message-ID: <87vc8wcpsm.fsf@fleche.redhat.com> (raw)
In-Reply-To: <513E5707.8080404@redhat.com> (Phil Muldoon's message of "Mon, 11	Mar 2013 22:13:27 +0000")

>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> +
Phil> +static int
Phil> +parse_no_frames_option (char *arg)

Needs an intro comment.  'arg' should be const.

Phil> +  if (arg && (strcmp (arg, "--no-frame-filters") == 0))

We recently decided to use explicit NULL checks, like 'arg != NULL'.

Phil> +  /* Parse arguments.  In this instance we are just looking for
Phil> +     --no-frame-filters.  */
Phil> +  while (1)
Phil> +    {
Phil> +      int oind = 0;
Phil> +      char *oarg;
Phil> +      int opt = mi_getopt ("-stack-list-frames", argc, argv,
Phil> +			   opts, &oind, &oarg);

I don't think it is correct to set oind in the loop.
It may work now but it will be wrong if we ever add more options.

Phil> +  if ((argc > 3 && ! raw_arg) || (argc == 1 && ! raw_arg)
Phil> +      || (argc == 2 && raw_arg))
Phil> +    error (_("-stack-list-frames: Usage: [--no-frame-filters] [FRAME_LOW FRAME_HIGH]"));

This code should use oind and not check raw_arg.  Actually the rest of
the function should use oind to index into argv.

Phil> +      /* We cannot pass -1 to frame_low, as that would signify a
Phil> +      relative backtrace from the tail of the stack.  So, in the case
Phil> +      of frame_low == -1, assign and increment it.  */
Phil> +      if (py_frame_low == -1)
Phil> +	py_frame_low++;

I didn't check, but I assume it is ok for frame_high==-1 in the call?

Phil> +  /* Run the inbuilt backtrace if there are no filters registered, or
Phil> +     if there was an error in the Python backtracing output, or if
Phil> +     frame-filters are disabled.  */
Phil> +  if (! frame_filters || raw_arg || result == PY_BT_ERROR
Phil> +      || result == PY_BT_NO_FILTERS)

It seems to me that the PY_BT_ERROR case should not be here, since the
MI client could get a partially filtered trace followed by the normal
trace.

'result' is initialized to 0 but it seems like it should be initialized
to some PY_BT_ enum value; and have the right type.

Phil> +    error (_("-stack-list-locals: Usage: [--no-frame-filters] PRINT_VALUES"));

I think -stack-list-frames takes "-no-frame-filters" but this and others
take the "--" form.  That seems confusing.

Phil> +       result = apply_frame_filter (frame, flags, print_value,
Phil> +				    current_uiout, 0,0);

Missing space after the ",".

Phil> +   if (! frame_filters || raw_arg || result == PY_BT_ERROR
Phil> +       || result == PY_BT_NO_FILTERS)
Phil> +     {
Phil> +       list_args_or_locals (locals, print_value, frame);

Same comments about PY_BT_ERROR and 'result'.
Actually this applies everywhere.

Tom


  reply	other threads:[~2013-03-12 20:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 22:13 Phil Muldoon
2013-03-12 20:43 ` Tom Tromey [this message]
2013-03-12 20:52   ` Phil Muldoon
2013-03-13 12:15     ` Phil Muldoon
2013-03-13 17:48     ` Tom Tromey
2013-03-13 19:41       ` Phil Muldoon
2013-03-13 20:27         ` Tom Tromey
2013-03-13 20:53           ` Phil Muldoon
2013-03-13 20:56             ` Tom Tromey
2013-03-13 21:10               ` Phil Muldoon
2013-03-14 17:54                 ` Tom Tromey
2013-03-14 19:35                   ` Phil Muldoon
  -- strict thread matches above, loose matches on Subject: below --
2013-05-06  8:23 Phil Muldoon
2013-05-06 20:42 ` Tom Tromey
2013-05-07  8:23   ` Phil Muldoon
2013-05-07 14:02     ` Tom Tromey
2013-05-08 10:18       ` Phil Muldoon
2013-05-08 19:47         ` Tom Tromey
2013-05-10 10:45           ` Phil Muldoon
2013-04-22 16:01 Phil Muldoon
2013-04-26 11:19 ` Tom Tromey
2012-11-30 14:31 Phil Muldoon
2012-12-05 17:11 ` Tom Tromey
2012-12-07 13:56   ` Phil Muldoon
2012-12-10 21:03     ` Tom Tromey
2013-02-05 12:08       ` Phil Muldoon
2013-02-07 21:32         ` Tom Tromey
2013-02-20 15:17       ` Phil Muldoon
2013-02-20 20:37         ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vc8wcpsm.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pmuldoon@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox