From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6552 invoked by alias); 21 Sep 2012 10:45:58 -0000 Received: (qmail 6541 invoked by uid 22791); 21 Sep 2012 10:45:55 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from imr4.ericy.com (HELO imr4.ericy.com) (198.24.6.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Sep 2012 10:45:41 +0000 Received: from eusaamw0712.eamcs.ericsson.se ([147.117.20.181]) by imr4.ericy.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id q8LAp94V028122 for ; Fri, 21 Sep 2012 05:51:11 -0500 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.2.164]) by eusaamw0712.eamcs.ericsson.se ([147.117.20.181]) with mapi; Fri, 21 Sep 2012 06:45:35 -0400 From: Marc Khouzam To: Marc Khouzam , "gdb-patches@sourceware.org" Date: Fri, 21 Sep 2012 10:45:00 -0000 Subject: RE: [MI][patch] -break-list to specify "thread-group" Message-ID: References: In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00430.txt.bz2 > Hi, >=20 > 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. >=20 > Currently: >=20 > (gdb) inf b > Num Type Disp Enb Address What > 1 breakpoint keep y > 1.1 y 0x08048533 in main() at loopfirst.cc:8 = inf 2 > 1.2 y 0x08048533 in main() at loopfirst.cc:8 = inf 1 >=20 > Notice the "inf 1" tag at the end. >=20 > (gdb) interpreter-exec mi -break-list > ^done,BreakpointTable=3D{nr_rows=3D"1",nr_cols=3D"6",hdr=3D[{width=3D"7",= alignment=3D"-1",col_name=3D"number",colhdr=3D"Num"},{width=3D"14",alignmen= t=3D"-1",col_name=3D"type",colhdr=3D"Type"},{width=3D"4",alignment=3D"-1",c= ol_name=3D"disp",colhdr=3D"Disp"},{width=3D"3",alignment=3D"-1",col_name=3D= "enabled",colhdr=3D"Enb"},{width=3D"10",alignment=3D"-1",col_name=3D"addr",= colhdr=3D"Address"},{width=3D"40",alignment=3D"2",col_name=3D"what",colhdr= =3D"What"}],body=3D[bkpt=3D{number=3D"1",type=3D"breakpoint",disp=3D"keep",= enabled=3D"y",addr=3D"",times=3D"0",original-location=3D"/home/lm= ckhou/testing/loopfirst.cc:8"},{number=3D"1.1",enabled=3D"y",addr=3D"0x0804= 8533",func=3D"main()",file=3D"loopfirst.cc",fullname=3D"/home/lmckhou/testi= ng/loopfirst.cc",line=3D"8"},{number=3D"1.2",enabled=3D"y",addr=3D"0x080485= 33",func=3D"main()",file=3D"loopfirst.cc",fullname=3D"/home/lmckhou/testing= /loopfirst.cc",line=3D"8"}]} >=20 > but no such info from MI. >=20 > The below patch adds this new field. I just realized I should use "i" 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: >=20 > (gdb) interpreter-exec mi -break-list > ^done,BreakpointTable=3D{nr_rows=3D"1",nr_cols=3D"6",hdr=3D[{width=3D"7",= alignment=3D"-1",col_name=3D"number",colhdr=3D"Num"},{width=3D"14",alignmen= t=3D"-1",col_name=3D"type",colhdr=3D"Type"},{width=3D"4",alignment=3D"-1",c= ol_name=3D"disp",colhdr=3D"Disp"},{width=3D"3",alignment=3D"-1",col_name=3D= "enabled",colhdr=3D"Enb"},{width=3D"10",alignment=3D"-1",col_name=3D"addr",= colhdr=3D"Address"},{width=3D"40",alignment=3D"2",col_name=3D"what",colhdr= =3D"What"}],body=3D[bkpt=3D{number=3D"1",type=3D"breakpoint",disp=3D"keep",= enabled=3D"y",addr=3D"",times=3D"0",original-location=3D"/home/lm= ckhou/testing/loopfirst.cc:8"},{number=3D"1.1",enabled=3D"y",addr=3D"0x0804= 8533",func=3D"main()",file=3D"loopfirst.cc",fullname=3D"/home/lmckhou/testi= ng/loopfirst.cc",line=3D"8",thread-group=3D["2"]},{number=3D"1.2",enabled= =3D"y",addr=3D"0x08048533",func=3D"main()",file=3D"loopfirst.cc",fullname= =3D"/home/lmckhou/testing/loopfirst.cc",line=3D"8",thread-group=3D["1"]}]} >=20 > 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) >=20 > (gdb) interpreter-exec mi -break-list > ^done,BreakpointTable=3D{nr_rows=3D"1",nr_cols=3D"6",hdr=3D[{width=3D"7",= alignment=3D"-1",col_name=3D"number",colhdr=3D"Num"},{width=3D"14",alignmen= t=3D"-1",col_name=3D"type",colhdr=3D"Type"},{width=3D"4",alignment=3D"-1",c= ol_name=3D"disp",colhdr=3D"Disp"},{width=3D"3",alignment=3D"-1",col_name=3D= "enabled",colhdr=3D"Enb"},{width=3D"10",alignment=3D"-1",col_name=3D"addr",= colhdr=3D"Address"},{width=3D"40",alignment=3D"2",col_name=3D"what",colhdr= =3D"What"}],body=3D[bkpt=3D{number=3D"1",type=3D"breakpoint",disp=3D"keep",= enabled=3D"y",addr=3D"",times=3D"0",original-location=3D"loopfirs= t.cc:8"},{number=3D"1.1",enabled=3D"y",addr=3D"0x08048533",func=3D"main()",= file=3D"loopfirst.cc",fullname=3D"/home/lmckhou/testing/loopfirst.cc",line= =3D"8",thread-group=3D["2","1"]},{number=3D"1.2",enabled=3D"y",addr=3D"0x08= 048533",func=3D"main()",file=3D"loopfirst.cc",fullname=3D"/home/lmckhou/tes= ting/loopfirst.cc",line=3D"8",thread-group=3D["2","1"]}]} >=20 >=20 > 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. >=20 > Can this patch go in as is? Or can I get some guidance > about how to handle this out-of-date MI output? >=20 > Thanks >=20 > Marc >=20 >=20 > 2012-09-20 Marc Khouzam >=20 > * breakpoint.c (print_one_breakpoint_location): Add MI > field 'thread-group' to output of -break-list. > (output_thread_groups): New function. >=20 >=20 > ### Eclipse Workspace Patch 1.0 > #P src > Index: gdb/breakpoint.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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; > } >=20 > +/* 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, cons= t char *xgroups) > +{ > + struct cleanup *back_to =3D make_cleanup_ui_out_list_begin_end (uiout, > + field_nam= e); > + char *groups =3D xstrdup (xgroups); > + char *p =3D groups; > + int first =3D 1; > + > + make_cleanup (xfree, groups); > + > + for (p =3D strtok (p, ","); p; p =3D strtok (NULL, ",")) > + { > + if (first) > + { > + first =3D 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. */ >=20 > static void > @@ -5944,21 +5974,27 @@ > { > struct inferior *inf; > int first =3D 1; > + char thread_groups[100]; > + const char *inf_name; > + int len; >=20 > + thread_groups[0] =3D 0; > for (inf =3D inferior_list; inf !=3D NULL; inf =3D inf->next) > { > if (inf->pspace =3D=3D loc->pspace) > { > if (first) > - { > - first =3D 0; > - ui_out_text (uiout, " inf "); > - } > + first =3D 0; > else > - ui_out_text (uiout, ", "); > - ui_out_text (uiout, plongest (inf->num)); > + strncat (thread_groups, ",", len); > + > + inf_name =3D plongest (inf->num); > + len =3D strlen (inf_name); > + strncat (thread_groups, inf_name, len); > } > } > + output_thread_groups (uiout, "thread-group", thread_groups); > + > } >=20 > if (!part_of_multiple)