Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marc Khouzam <marc.khouzam@ericsson.com>
To: Marc Khouzam <marc.khouzam@ericsson.com>,
	       "gdb-patches@sourceware.org"	<gdb-patches@sourceware.org>
Subject: RE: [MI][patch] -break-list to specify "thread-group"
Date: Fri, 21 Sep 2012 10:45:00 -0000	[thread overview]
Message-ID: <F7CE05678329534C957159168FA70DEC5E11404FE0@EUSAACMS0703.eamcs.ericsson.se> (raw)
In-Reply-To: <F7CE05678329534C957159168FA70DEC5E11404FDC@EUSAACMS0703.eamcs.ericsson.se>

> Hi,
> 
> In Eclipse I'm trying to filter breakpoints per thread and/or
> per process.  Currently -break-list does not tell me the inferior
> of a bp as 'info break' does.
> 
> Currently:
> 
> (gdb) inf b
> Num     Type           Disp Enb Address    What
> 1       breakpoint     keep y   <MULTIPLE>
> 1.1                         y     0x08048533 in main() at loopfirst.cc:8 inf 2
> 1.2                         y     0x08048533 in main() at loopfirst.cc:8 inf 1
> 
> Notice the "inf 1" tag at the end.
> 
> (gdb) interpreter-exec mi -break-list
> ^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<MULTIPLE>",times="0",original-location="/home/lmckhou/testing/loopfirst.cc:8"},{number="1.1",enabled="y",addr="0x08048533",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="8"},{number="1.2",enabled="y",addr="0x08048533",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="8"}]}
> 
> but no such info from MI.
> 
> The below patch adds this new field.

I just realized I should use "i<num>" for an MI thread-group id e.g., "i1", "i2"
I'll come back with a new version of the patch.

Sorry about that.

> The output would then look like:
> 
> (gdb) interpreter-exec mi -break-list
> ^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<MULTIPLE>",times="0",original-location="/home/lmckhou/testing/loopfirst.cc:8"},{number="1.1",enabled="y",addr="0x08048533",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="8",thread-group=["2"]},{number="1.2",enabled="y",addr="0x08048533",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="8",thread-group=["1"]}]}
> 
> or (if the bp applies to multiple inferiors, which I didn't quite
> out how to officially trigger, so I hacked the code to make sure
> the output was done properly in that case)
> 
> (gdb) interpreter-exec mi -break-list
> ^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<MULTIPLE>",times="0",original-location="loopfirst.cc:8"},{number="1.1",enabled="y",addr="0x08048533",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="8",thread-group=["2","1"]},{number="1.2",enabled="y",addr="0x08048533",func="main()",file="loopfirst.cc",fullname="/home/lmckhou/testing/loopfirst.cc",line="8",thread-group=["2","1"]}]}
> 
> 
> I was going to update the doc, but when I looked at it
> I realized it was completely out-of-date with respect to
> -break-list _and_ that the MI output itself does not to have
> the right content in the  'hdr' part.  I wasn't sure if I can
> change such MI output or not due to backwards
> compatibility.
> 
> Can this patch go in as is?  Or can I get some guidance
> about how to handle this out-of-date MI output?
> 
> Thanks
> 
> Marc
> 
> 
> 2012-09-20  Marc Khouzam  <marc.khouzam@ericsson.com>
> 
>         * breakpoint.c (print_one_breakpoint_location): Add MI
>         field 'thread-group' to output of -break-list.
>         (output_thread_groups): New function.
> 
> 
> ### Eclipse Workspace Patch 1.0
> #P src
> Index: gdb/breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.704
> diff -u -r1.704 breakpoint.c
> --- gdb/breakpoint.c    17 Sep 2012 07:03:14 -0000      1.704
> +++ gdb/breakpoint.c    21 Sep 2012 09:50:03 -0000
> @@ -5779,6 +5779,36 @@
>    return bptypes[(int) type].description;
>  }
> 
> +/* Output a field named 'thread-group' with a list as the value.  The
> +   elements of the list are obtained by splitting 'groups' on
> +   comma.  */
> +
> +static void
> +output_thread_groups (struct ui_out *uiout, const char *field_name, const char *xgroups)
> +{
> +  struct cleanup *back_to = make_cleanup_ui_out_list_begin_end (uiout,
> +                                                               field_name);
> +  char *groups = xstrdup (xgroups);
> +  char *p = groups;
> +  int first = 1;
> +
> +  make_cleanup (xfree, groups);
> +
> +  for (p = strtok (p, ","); p;  p = strtok (NULL, ","))
> +    {
> +      if (first)
> +       {
> +         first = 0;
> +         ui_out_text (uiout, " inf ");
> +       }
> +      else
> +       ui_out_text (uiout, ", ");
> +      ui_out_field_string (uiout, NULL, p);
> +    }
> +
> +  do_cleanups (back_to);
> +}
> +
>  /* Print B to gdb_stdout.  */
> 
>  static void
> @@ -5944,21 +5974,27 @@
>      {
>        struct inferior *inf;
>        int first = 1;
> +      char thread_groups[100];
> +      const char *inf_name;
> +      int len;
> 
> +      thread_groups[0] = 0;
>        for (inf = inferior_list; inf != NULL; inf = inf->next)
>         {
>           if (inf->pspace == loc->pspace)
>             {
>               if (first)
> -               {
> -                 first = 0;
> -                 ui_out_text (uiout, " inf ");
> -               }
> +               first = 0;
>               else
> -               ui_out_text (uiout, ", ");
> -             ui_out_text (uiout, plongest (inf->num));
> +               strncat (thread_groups, ",", len);
> +
> +             inf_name = plongest (inf->num);
> +             len = strlen (inf_name);
> +             strncat (thread_groups, inf_name, len);
>             }
>         }
> +       output_thread_groups (uiout, "thread-group", thread_groups);
> +
>      }
> 
>    if (!part_of_multiple)


  reply	other threads:[~2012-09-21 10:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 10:01 Marc Khouzam
2012-09-21 10:45 ` Marc Khouzam [this message]
2012-09-21 14:47   ` [MI][patch v2] " Marc Khouzam
2012-09-22 13:00     ` Yao Qi
2012-09-26 10:05       ` Marc Khouzam
2012-09-28 19:23         ` Tom Tromey
2012-10-01 16:10           ` Marc Khouzam
2012-10-01 16:17             ` Eli Zaretskii
2012-10-15 10:39             ` Marc Khouzam
2012-10-24 18:43               ` Marc Khouzam
2012-11-27 19:56                 ` Marc Khouzam
2012-11-28  6:07                   ` Abid, Hafiz
2012-11-30 18:35                     ` Tom Tromey
2012-09-28 19:21       ` Tom Tromey
2012-12-07 15:37       ` Pedro Alves
2012-12-07 15:44         ` Pedro Alves
2013-01-16 16:58           ` Marc Khouzam
2013-01-21 18:54             ` Pedro Alves
2013-01-22  0:09               ` Marc Khouzam
2012-09-28 19:10     ` Tom Tromey
2012-09-28 19:18     ` Tom Tromey
2012-09-21 18:12 ` [MI][patch] " André Pönitz
2012-09-21 18:54   ` Marc Khouzam

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=F7CE05678329534C957159168FA70DEC5E11404FE0@EUSAACMS0703.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /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