[RFC] Fix the MI result of -break-insert with multiple locations

Marc Khouzam marc.khouzam@ericsson.com
Tue Jan 29 15:39:00 GMT 2013


> -----Original Message-----
> From: Mircea Gherzan [mailto:mircea.gherzan@intel.com] 
> Sent: Tuesday, January 29, 2013 9:36 AM
> To: tromey@redhat.com; vladimir@codesourcery.com; Marc Khouzam
> Cc: gdb-patches@sourceware.org; mircea.gherzan@intel.com
> Subject: [RFC] Fix the MI result of -break-insert with 
> multiple locations
> 
> The current MI output when printing a breakpoint with 
> multiple locations
> is not conformant to the MI specification:
> 
>   bkpt={number="1", ...},{number="1.1", ...},{number="1.2", ...}

The above is an excerpt of the slightly more complete excerpt:
body=[bkpt={number="1", ...},{number="1.1", ...},{number="1.2", ...}]

and I think this fits with MI grammar:
"body" => variable
=
[bkpt=*] => value which is a list
and a list can be composed of many values which can be tuples:
{number="1", ...},{number="1.1", ...},{number="1.2", ...}

So, I believe the current syntax is valid, no?

BTW, Eclipse does not parse it properly currently because we made
the assumption there would be only one tuple.  We'll need to fix 
that in Eclipse.

Marc


> This patch fixes this issue by moving the locations to a list 
> inside the
> first tuple:
> 
>   bkpt={number="1", ... , locations=[{number="1.1", ...}, ...]}
> 
> 2013-01-28  Mircea Gherzan  <mircea.gherzan@intel.com>
> 
> 	* breakpoint.c (print_one_breakpoint): Use a list of breakpoint
> 	locations that adheres to the MI specification.
> 
> Signed-off-by: Mircea Gherzan <mircea.gherzan@intel.com>
> ---
>  gdb/breakpoint.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index 216ac73..7050f96 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -6216,7 +6216,6 @@ print_one_breakpoint (struct breakpoint *b,
>    bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "bkpt");
>  
>    print_one_breakpoint_location (b, NULL, 0, last_loc, allflag);
> -  do_cleanups (bkpt_chain);
>  
>    /* If this breakpoint has custom print function,
>       it's already printed.  Otherwise, print individual
> @@ -6235,8 +6234,11 @@ print_one_breakpoint (struct breakpoint *b,
>  	  && (b->loc->next || !b->loc->enabled))
>  	{
>  	  struct bp_location *loc;
> +	  struct cleanup *loc_list;
>  	  int n = 1;
>  
> +	  loc_list = make_cleanup_ui_out_list_begin_end (uiout, 
> "locations");
> +
>  	  for (loc = b->loc; loc; loc = loc->next, ++n)
>  	    {
>  	      struct cleanup *inner2 =
> @@ -6244,8 +6246,12 @@ print_one_breakpoint (struct breakpoint *b,
>  	      print_one_breakpoint_location (b, loc, n, 
> last_loc, allflag);
>  	      do_cleanups (inner2);
>  	    }
> +
> +	  do_cleanups (loc_list);
>  	}
>      }
> +
> +  do_cleanups (bkpt_chain);
>  }
>  
>  static int
> -- 
> 1.7.1
> 
> 



More information about the Gdb-patches mailing list