Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@cygnus.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa] restructure breakpoint.c:breakpoint_1()
Date: Mon, 18 Jun 2001 09:09:00 -0000	[thread overview]
Message-ID: <3B2E27CE.AF209808@cygnus.com> (raw)
In-Reply-To: <3B2B9351.2090607@cygnus.com>

Andrew Cagney wrote:
> 
> Hello,
> 
> The attatched patch splits breakpoint_1() into two separate phases:
> 
>         o       phase one determines the number of
>                 breakpoints and hence what headers
>                 are needed.
> 
>         o       phase two prints the actual breakpoints
> 
> Once this change is in, I can modify things so that ui-out is passed the
> number of items to be printed and hence, make it ui-out's responsibility
> to determine if the header should or should not be displayed.  This in
> turn lets me fix a bug where the MI didn't always include the header in
> a table.
> 
> Ok?  I'm still testing...

OK, but could you:
  1) Supply a header comment for your new function, and
  2) While you're at it, update the comment header for breakpoint_1?
I notice that it refers to a parameter that no longer exists, while
failing to describe the "allflag" parameter.


> 
>         Andrew
> 
>   ----------------------------------------------------------------------------------------------------
> 2001-06-16  Andrew Cagney  <ac131313@redhat.com>
> 
>         * breakpoint.c (breakpoint_1): Restructure.  Compute the
>         nr_printable_breakpoints.  Move the header output to before the
>         main print breakpoints loop.
>         (user_settable_breakpoint): New function.
> 
> Index: breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.41
> diff -p -r1.41 breakpoint.c
> *** breakpoint.c        2001/06/11 16:05:24     1.41
> --- breakpoint.c        2001/06/16 17:03:00
> *************** gdb_breakpoint_query (/* output object,
> *** 3551,3563 ****
>      If WATCHPOINTS is zero, process only breakpoints; if WATCHPOINTS
>      is nonzero, process only watchpoints.  */
> 
>   static void
>   breakpoint_1 (int bnum, int allflag)
>   {
>     register struct breakpoint *b;
>     CORE_ADDR last_addr = (CORE_ADDR) -1;
> !   int found_a_breakpoint = 0;
> 
>   #ifdef UI_OUT
>     if (addressprint)
>       ui_out_table_begin (uiout, 6, "BreakpointTable");
> --- 3551,3591 ----
>      If WATCHPOINTS is zero, process only breakpoints; if WATCHPOINTS
>      is nonzero, process only watchpoints.  */
> 
> + static int
> + user_settable_breakpoint (const struct breakpoint *b)
> + {
> +   return (b->type == bp_breakpoint
> +         || b->type == bp_catch_load
> +         || b->type == bp_catch_unload
> +         || b->type == bp_catch_fork
> +         || b->type == bp_catch_vfork
> +         || b->type == bp_catch_exec
> +         || b->type == bp_catch_catch
> +         || b->type == bp_catch_throw
> +         || b->type == bp_hardware_breakpoint
> +         || b->type == bp_watchpoint
> +         || b->type == bp_read_watchpoint
> +         || b->type == bp_access_watchpoint
> +         || b->type == bp_hardware_watchpoint);
> + }
> +
>   static void
>   breakpoint_1 (int bnum, int allflag)
>   {
>     register struct breakpoint *b;
>     CORE_ADDR last_addr = (CORE_ADDR) -1;
> !   int nr_printable_breakpoints;
> 
> +   /* Compute the number of rows in the table. */
> +   nr_printable_breakpoints = 0;
> +   ALL_BREAKPOINTS (b)
> +     if (bnum == -1
> +       || bnum == b->number)
> +       {
> +       if (allflag || user_settable_breakpoint (b))
> +         nr_printable_breakpoints++;
> +       }
> +
>   #ifdef UI_OUT
>     if (addressprint)
>       ui_out_table_begin (uiout, 6, "BreakpointTable");
> *************** breakpoint_1 (int bnum, int allflag)
> *** 3565,3642 ****
>       ui_out_table_begin (uiout, 5, "BreakpointTable");
>   #endif /* UI_OUT */
> 
>     ALL_BREAKPOINTS (b)
>       if (bnum == -1
>         || bnum == b->number)
>         {
>         /* We only print out user settable breakpoints unless the
>            allflag is set. */
> !       if (!allflag
> !           && b->type != bp_breakpoint
> !           && b->type != bp_catch_load
> !           && b->type != bp_catch_unload
> !           && b->type != bp_catch_fork
> !           && b->type != bp_catch_vfork
> !           && b->type != bp_catch_exec
> !           && b->type != bp_catch_catch
> !           && b->type != bp_catch_throw
> !           && b->type != bp_hardware_breakpoint
> !           && b->type != bp_watchpoint
> !           && b->type != bp_read_watchpoint
> !           && b->type != bp_access_watchpoint
> !           && b->type != bp_hardware_watchpoint)
> !         continue;
> !
> !       if (!found_a_breakpoint++)
> !         {
> !           annotate_breakpoints_headers ();
> ! #ifdef UI_OUT
> !           annotate_field (0);
> !           ui_out_table_header (uiout, 3, ui_left, "Num");     /* 1 */
> !           annotate_field (1);
> !           ui_out_table_header (uiout, 14, ui_left, "Type");   /* 2 */
> !           annotate_field (2);
> !           ui_out_table_header (uiout, 4, ui_left, "Disp");    /* 3 */
> !           annotate_field (3);
> !           ui_out_table_header (uiout, 3, ui_left, "Enb");     /* 4 */
> !           if (addressprint)
> !             {
> !               annotate_field (4);
> !               if (TARGET_ADDR_BIT <= 32)
> !                 ui_out_table_header (uiout, 10, ui_left, "Address");  /* 5 */
> !               else
> !                 ui_out_table_header (uiout, 18, ui_left, "Address");  /* 5 */
> !             }
> !           annotate_field (5);
> !           ui_out_table_header (uiout, 40, ui_noalign, "What");        /* 6 */
> !           ui_out_table_body (uiout);
> ! #else
> !           annotate_field (0);
> !           printf_filtered ("Num ");
> !           annotate_field (1);
> !           printf_filtered ("Type           ");
> !           annotate_field (2);
> !           printf_filtered ("Disp ");
> !           annotate_field (3);
> !           printf_filtered ("Enb ");
> !           if (addressprint)
> !             {
> !               annotate_field (4);
> !               if (TARGET_ADDR_BIT <= 32)
> !                 printf_filtered ("Address    ");
> !               else
> !                 printf_filtered ("Address            ");
> !             }
> !           annotate_field (5);
> !           printf_filtered ("What\n");
> ! #endif /* UI_OUT */
> !           annotate_breakpoints_table ();
> !         }
> !
> !       print_one_breakpoint (b, &last_addr);
>         }
> 
> !   if (!found_a_breakpoint)
>       {
>   #ifdef UI_OUT
>         if (bnum == -1)
> --- 3593,3660 ----
>       ui_out_table_begin (uiout, 5, "BreakpointTable");
>   #endif /* UI_OUT */
> 
> + #ifdef UI_OUT
> +   if (nr_printable_breakpoints > 0)
> +     {
> +       annotate_breakpoints_headers ();
> +       annotate_field (0);
> +       ui_out_table_header (uiout, 3, ui_left, "Num"); /* 1 */
> +       annotate_field (1);
> +       ui_out_table_header (uiout, 14, ui_left, "Type");       /* 2 */
> +       annotate_field (2);
> +       ui_out_table_header (uiout, 4, ui_left, "Disp");        /* 3 */
> +       annotate_field (3);
> +       ui_out_table_header (uiout, 3, ui_left, "Enb"); /* 4 */
> +       if (addressprint)
> +       {
> +         annotate_field (4);
> +         if (TARGET_ADDR_BIT <= 32)
> +           ui_out_table_header (uiout, 10, ui_left, "Address");        /* 5 */
> +         else
> +           ui_out_table_header (uiout, 18, ui_left, "Address");        /* 5 */
> +       }
> +       annotate_field (5);
> +       ui_out_table_header (uiout, 40, ui_noalign, "What");    /* 6 */
> +       ui_out_table_body (uiout);
> +       annotate_breakpoints_table ();
> +     }
> + #else
> +   if (nr_printable_breakpoints > 0)
> +     {
> +       annotate_breakpoints_headers ();
> +       annotate_field (0);
> +       printf_filtered ("Num ");
> +       annotate_field (1);
> +       printf_filtered ("Type           ");
> +       annotate_field (2);
> +       printf_filtered ("Disp ");
> +       annotate_field (3);
> +       printf_filtered ("Enb ");
> +       if (addressprint)
> +       {
> +         annotate_field (4);
> +         if (TARGET_ADDR_BIT <= 32)
> +           printf_filtered ("Address    ");
> +         else
> +           printf_filtered ("Address            ");
> +       }
> +       annotate_field (5);
> +       printf_filtered ("What\n");
> +       annotate_breakpoints_table ();
> +     }
> + #endif /* UI_OUT */
> +
>     ALL_BREAKPOINTS (b)
>       if (bnum == -1
>         || bnum == b->number)
>         {
>         /* We only print out user settable breakpoints unless the
>            allflag is set. */
> !       if (allflag || user_settable_breakpoint (b))
> !         print_one_breakpoint (b, &last_addr);
>         }
> 
> !   if (nr_printable_breakpoints == 0)
>       {
>   #ifdef UI_OUT
>         if (bnum == -1)


       reply	other threads:[~2001-06-18  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3B2B9351.2090607@cygnus.com>
2001-06-18  9:09 ` Michael Snyder [this message]
2001-06-18 11:08   ` Andrew Cagney

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=3B2E27CE.AF209808@cygnus.com \
    --to=msnyder@cygnus.com \
    --cc=ac131313@cygnus.com \
    --cc=gdb-patches@sources.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