Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] MI and MI2 should have identical behavior on -target-download  command
@ 2007-08-20 21:04 Maxim Grigoriev
  2007-08-21 12:16 ` Nick Roberts
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Grigoriev @ 2007-08-20 21:04 UTC (permalink / raw)
  To: gdb-patches, Pete MacLiesh, Marc Gauthier, Ross Morley

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

This patch has to be approved before I can commit it.

It fixes a small glitch in GDB MI. MI2 is a default. So
MI and MI2 should work identically. The MI2 being set as
a default is hard-coded in several places. I think one
place was missed:

    mi/mi-main.c::mi_load_progress().

Without this fix, MI "-target-download" command behaves
differently on MI versus MI2 not showing loading progress,
when "-i=mi2" is used.

GDB front-ends developers might want to stick with "-i=mi"
assuming they always use a default. It would be a bad idea
to force them to use explicit options like "-i=mi2".

-- Maxim



[-- Attachment #2: mi2_default_patch.diff --]
[-- Type: text/x-patch, Size: 785 bytes --]

2007-08-20  Maxim Grigoriev  <maxim2405@gmail.com>

	* mi/mi-main.c (mi_load_progress): Make MI and MI2 behave
	identically on -target-download command as long as MI2 is a default.

Index: gdb/mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.101
diff -u -r1.101 mi-main.c
--- gdb/mi/mi-main.c	10 Aug 2007 21:52:38 -0000	1.101
+++ gdb/mi/mi-main.c	20 Aug 2007 20:19:57 -0000
@@ -1465,7 +1465,8 @@
      of this function.  */
   saved_uiout = uiout;
 
-  if (current_interp_named_p (INTERP_MI))
+  if (current_interp_named_p (INTERP_MI)
+      || current_interp_named_p (INTERP_MI2))
     uiout = mi_out_new (2);
   else if (current_interp_named_p (INTERP_MI1))
     uiout = mi_out_new (1);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] MI and MI2 should have identical behavior on -target-download  command
  2007-08-20 21:04 [PATCH] MI and MI2 should have identical behavior on -target-download command Maxim Grigoriev
@ 2007-08-21 12:16 ` Nick Roberts
  2007-08-21 13:28   ` Daniel Jacobowitz
  2007-08-21 17:43   ` Maxim Grigoriev
  0 siblings, 2 replies; 9+ messages in thread
From: Nick Roberts @ 2007-08-21 12:16 UTC (permalink / raw)
  To: Maxim Grigoriev; +Cc: gdb-patches, Pete MacLiesh, Marc Gauthier, Ross Morley

 > It fixes a small glitch in GDB MI. MI2 is a default. So
 > MI and MI2 should work identically. The MI2 being set as
 > a default is hard-coded in several places. I think one
 > place was missed:
 > 
 >     mi/mi-main.c::mi_load_progress().
 > 
 > Without this fix, MI "-target-download" command behaves
 > differently on MI versus MI2 not showing loading progress,
 > when "-i=mi2" is used.
 >
 > GDB front-ends developers might want to stick with "-i=mi"
 > assuming they always use a default. It would be a bad idea
 > to force them to use explicit options like "-i=mi2".

What behaviour do you want for mi3?

 >...
 > -  if (current_interp_named_p (INTERP_MI))
 > +  if (current_interp_named_p (INTERP_MI)
 > +      || current_interp_named_p (INTERP_MI2))
 >      uiout = mi_out_new (2);
 >    else if (current_interp_named_p (INTERP_MI1))
 >      uiout = mi_out_new (1);

-- 
Nick                                           http://www.inet.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] MI and MI2 should have identical behavior on  -target-download  command
  2007-08-21 12:16 ` Nick Roberts
@ 2007-08-21 13:28   ` Daniel Jacobowitz
  2007-08-22  5:33     ` Nick Roberts
  2007-09-03 17:51     ` Daniel Jacobowitz
  2007-08-21 17:43   ` Maxim Grigoriev
  1 sibling, 2 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2007-08-21 13:28 UTC (permalink / raw)
  To: Nick Roberts
  Cc: Maxim Grigoriev, gdb-patches, Pete MacLiesh, Marc Gauthier, Ross Morley

On Wed, Aug 22, 2007 at 12:16:01AM +1200, Nick Roberts wrote:
>  > It fixes a small glitch in GDB MI. MI2 is a default. So
>  > MI and MI2 should work identically. The MI2 being set as
>  > a default is hard-coded in several places. I think one
>  > place was missed:
>  > 
>  >     mi/mi-main.c::mi_load_progress().

Sorry, we (specifically Andrew Stubbs) noticed this problem in
November 2005, but no one got around to fixing it.

>  > Without this fix, MI "-target-download" command behaves
>  > differently on MI versus MI2 not showing loading progress,
>  > when "-i=mi2" is used.
>  >
>  > GDB front-ends developers might want to stick with "-i=mi"
>  > assuming they always use a default. It would be a bad idea
>  > to force them to use explicit options like "-i=mi2".
> 
> What behaviour do you want for mi3?

MI3 should probably print the progress indicator too.  Like below.
Anyone disagree with this patch?

-- 
Daniel Jacobowitz
CodeSourcery

2007-08-21  Maxim Grigoriev  <maxim2405@gmail.com>
	    Daniel Jacobowitz  <dan@codesourcery.com>

	* mi-main.c (mi_load_progress): Handle MI2 and MI3 interpreters.

Index: mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.101
diff -u -p -r1.101 mi-main.c
--- mi-main.c	10 Aug 2007 21:52:38 -0000	1.101
+++ mi-main.c	21 Aug 2007 13:26:30 -0000
@@ -1465,10 +1465,13 @@ mi_load_progress (const char *section_na
      of this function.  */
   saved_uiout = uiout;
 
-  if (current_interp_named_p (INTERP_MI))
+  if (current_interp_named_p (INTERP_MI)
+      || current_interp_named_p (INTERP_MI2))
     uiout = mi_out_new (2);
   else if (current_interp_named_p (INTERP_MI1))
     uiout = mi_out_new (1);
+  else if (current_interp_named_p (INTERP_MI3))
+    uiout = mi_out_new (3);
   else
     return;
 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] MI and MI2 should have identical behavior on -target-download   command
  2007-08-21 12:16 ` Nick Roberts
  2007-08-21 13:28   ` Daniel Jacobowitz
@ 2007-08-21 17:43   ` Maxim Grigoriev
  1 sibling, 0 replies; 9+ messages in thread
From: Maxim Grigoriev @ 2007-08-21 17:43 UTC (permalink / raw)
  To: Nick Roberts
  Cc: Maxim Grigoriev, gdb-patches, Pete MacLiesh, Marc Gauthier, Ross Morley

>> What behavior do you want for mi3?

I think it's reasonable to make mi2 and mi3 work similarly 
on -target-download. At least, until MI3 becomes a default,
and GDB community comes up with a different ideas about it.

I understood Daniel has the same opinion (see the follow-up email).

-- Maxim

Nick Roberts wrote:
>  > It fixes a small glitch in GDB MI. MI2 is a default. So
>  > MI and MI2 should work identically. The MI2 being set as
>  > a default is hard-coded in several places. I think one
>  > place was missed:
>  > 
>  >     mi/mi-main.c::mi_load_progress().
>  > 
>  > Without this fix, MI "-target-download" command behaves
>  > differently on MI versus MI2 not showing loading progress,
>  > when "-i=mi2" is used.
>  >
>  > GDB front-ends developers might want to stick with "-i=mi"
>  > assuming they always use a default. It would be a bad idea
>  > to force them to use explicit options like "-i=mi2".
>
> What behaviour do you want for mi3?
>
>  >...
>  > -  if (current_interp_named_p (INTERP_MI))
>  > +  if (current_interp_named_p (INTERP_MI)
>  > +      || current_interp_named_p (INTERP_MI2))
>  >      uiout = mi_out_new (2);
>  >    else if (current_interp_named_p (INTERP_MI1))
>  >      uiout = mi_out_new (1);
>
>   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] MI and MI2 should have identical behavior on  -target-download  command
  2007-08-21 13:28   ` Daniel Jacobowitz
@ 2007-08-22  5:33     ` Nick Roberts
  2007-08-22 11:09       ` Daniel Jacobowitz
  2007-09-03 17:51     ` Daniel Jacobowitz
  1 sibling, 1 reply; 9+ messages in thread
From: Nick Roberts @ 2007-08-22  5:33 UTC (permalink / raw)
  To: Daniel Jacobowitz
  Cc: Maxim Grigoriev, gdb-patches, Pete MacLiesh, Marc Gauthier, Ross Morley

 > -  if (current_interp_named_p (INTERP_MI))
 > +  if (current_interp_named_p (INTERP_MI)
 > +      || current_interp_named_p (INTERP_MI2))
 >      uiout = mi_out_new (2);
 >    else if (current_interp_named_p (INTERP_MI1))
 >      uiout = mi_out_new (1);
 > +  else if (current_interp_named_p (INTERP_MI3))
 > +    uiout = mi_out_new (3);
 >    else
 >      return;

Sorry, my comment was meant to be more general: What behaviour do you want for
miN?  where N >= 3.

Elsewhere GDB uses:

if (mi_version (uiout) < 2)

although that probably wouldn't work here.  I don't really no why GDB goes
through so many hoops with this.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] MI and MI2 should have identical behavior on  -target-download  command
  2007-08-22  5:33     ` Nick Roberts
@ 2007-08-22 11:09       ` Daniel Jacobowitz
  2007-08-23  6:11         ` Nick Roberts
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2007-08-22 11:09 UTC (permalink / raw)
  To: Nick Roberts
  Cc: Maxim Grigoriev, gdb-patches, Pete MacLiesh, Marc Gauthier, Ross Morley

On Wed, Aug 22, 2007 at 05:33:44PM +1200, Nick Roberts wrote:
> Sorry, my comment was meant to be more general: What behaviour do you want for
> miN?  where N >= 3.

The same as the current MI2 behavior, I think.  There's only a
difference because of an accident and because of the strange
properties of how this hook is called.  That's part of why it's
deprecated, I guess.  It gets called sometimes when the global uiout
is wrong.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] MI and MI2 should have identical behavior on  -target-download  command
  2007-08-22 11:09       ` Daniel Jacobowitz
@ 2007-08-23  6:11         ` Nick Roberts
  2007-08-23 11:48           ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Roberts @ 2007-08-23  6:11 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > > Sorry, my comment was meant to be more general: What behaviour do you want
 > > for miN?  where N >= 3.
 > 
 > The same as the current MI2 behavior, I think.  

But your patch only gives that behaviour for N = 3.

 >                                                 There's only a
 > difference because of an accident and because of the strange
 > properties of how this hook is called.  That's part of why it's
 > deprecated, I guess.  It gets called sometimes when the global uiout
 > is wrong.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] MI and MI2 should have identical behavior on  -target-download  command
  2007-08-23  6:11         ` Nick Roberts
@ 2007-08-23 11:48           ` Daniel Jacobowitz
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2007-08-23 11:48 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Thu, Aug 23, 2007 at 06:11:42PM +1200, Nick Roberts wrote:
>  > > Sorry, my comment was meant to be more general: What behaviour do you want
>  > > for miN?  where N >= 3.
>  > 
>  > The same as the current MI2 behavior, I think.  
> 
> But your patch only gives that behaviour for N = 3.

For each version it creates a uiout with the same level.  I can't
exactly call mi_out_new (4) yet...

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] MI and MI2 should have identical behavior on  -target-download  command
  2007-08-21 13:28   ` Daniel Jacobowitz
  2007-08-22  5:33     ` Nick Roberts
@ 2007-09-03 17:51     ` Daniel Jacobowitz
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2007-09-03 17:51 UTC (permalink / raw)
  To: Nick Roberts, Maxim Grigoriev, gdb-patches, Pete MacLiesh,
	Marc Gauthier, Ross Morley

On Tue, Aug 21, 2007 at 09:27:53AM -0400, Daniel Jacobowitz wrote:
> 2007-08-21  Maxim Grigoriev  <maxim2405@gmail.com>
> 	    Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* mi-main.c (mi_load_progress): Handle MI2 and MI3 interpreters.

I checked this in.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-09-03 17:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-20 21:04 [PATCH] MI and MI2 should have identical behavior on -target-download command Maxim Grigoriev
2007-08-21 12:16 ` Nick Roberts
2007-08-21 13:28   ` Daniel Jacobowitz
2007-08-22  5:33     ` Nick Roberts
2007-08-22 11:09       ` Daniel Jacobowitz
2007-08-23  6:11         ` Nick Roberts
2007-08-23 11:48           ` Daniel Jacobowitz
2007-09-03 17:51     ` Daniel Jacobowitz
2007-08-21 17:43   ` Maxim Grigoriev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox