public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/10826] New: possibly re-order '^done' message and python script output in MI mode
@ 2009-10-22  7:21 andre dot poenitz at nokia dot com
  2009-10-22  7:26 ` [Bug python/10826] " pmuldoon at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: andre dot poenitz at nokia dot com @ 2009-10-22  7:21 UTC (permalink / raw)
  To: gdb-prs

When I issue a python based command 'xx' in mi mode I get output similar to the
following:

&"xx\n"
>^done
>~"the output"

i.e. the ^done message comes before the actual script output. that's somewhat
inconvenient if one wants to capture the script output as long as there is no
clear 'end of transmission' marker.

It would be nicer if the ^done message were sent only after the script output,
or possibly even better, if the script output would be made proper part of the
^done message.


The behaviour is reproducible with b6fd5e85924d71f28bb7e9d463e97bfd26a25f80 and
has been around for a while, probably all the time.

-- 
           Summary: possibly re-order '^done' message and python script
                    output in MI mode
           Product: gdb
           Version: archer
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: python
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: andre dot poenitz at nokia dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10826

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10826] possibly re-order '^done' message and python script output in MI mode
  2009-10-22  7:21 [Bug python/10826] New: possibly re-order '^done' message and python script output in MI mode andre dot poenitz at nokia dot com
@ 2009-10-22  7:26 ` pmuldoon at redhat dot com
  2009-11-03 13:44 ` pmuldoon at redhat dot com
  2009-11-03 13:45 ` pmuldoon at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pmuldoon at redhat dot com @ 2009-10-22  7:26 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pmuldoon at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10826

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10826] possibly re-order '^done' message and python script output in MI mode
  2009-10-22  7:21 [Bug python/10826] New: possibly re-order '^done' message and python script output in MI mode andre dot poenitz at nokia dot com
  2009-10-22  7:26 ` [Bug python/10826] " pmuldoon at redhat dot com
@ 2009-11-03 13:44 ` pmuldoon at redhat dot com
  2009-11-03 13:45 ` pmuldoon at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pmuldoon at redhat dot com @ 2009-11-03 13:44 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|pmuldoon at redhat dot com
                   |org                         |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1


http://sourceware.org/bugzilla/show_bug.cgi?id=10826

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10826] possibly re-order '^done' message and python script output in MI mode
  2009-10-22  7:21 [Bug python/10826] New: possibly re-order '^done' message and python script output in MI mode andre dot poenitz at nokia dot com
  2009-10-22  7:26 ` [Bug python/10826] " pmuldoon at redhat dot com
  2009-11-03 13:44 ` pmuldoon at redhat dot com
@ 2009-11-03 13:45 ` pmuldoon at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pmuldoon at redhat dot com @ 2009-11-03 13:45 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pmuldoon at redhat dot com  2009-11-03 13:45 -------
I submitted a patch for what I thought would the solution here:

http://sourceware.org/ml/archer/2009-q4/msg00023.html

And Tom reviewed it here:

http://sourceware.org/ml/archer/2009-q4/msg00033.html

Tom quite rightly points out that commands are required to flush the buffer or
emit a newline. And that this should be the same for Python scripts. I decided
to write a hello world command and test if the output was sequenced correctly if
there were multiple writes, and one flush: 

class HelloWorld (gdb.Command):
  """Greet the whole world."""

  def __init__ (self):
    super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_OBSCURE)

  def invoke (self, arg, from_tty):
    gdb.write("Hello, World!")
    gdb.write("Lovely weather!")
    gdb.write("What a nice day for a walk")
    gdb.flush()

HelloWorld ()

output:

(gdb) 
python execfile("/home/build/helloworld2.py")
&"python execfile(\"/home/build/helloworld2.py\")\n"
^done
(gdb) 
hello-world
&"hello-world\n"
~"Hello, World!Lovely weather!What a nice day for a walk"
^done


I also tested the case with just a new line at the end, and no flush:

hello-world
&"hello-world\n"
~"Hello, World!Lovely weather!What a nice day for a walk\n"
^done
(gdb) 

So in both cases this works, and no patch is needed. So closing, happily with no
patches needed! 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=10826

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2009-11-03 13:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-22  7:21 [Bug python/10826] New: possibly re-order '^done' message and python script output in MI mode andre dot poenitz at nokia dot com
2009-10-22  7:26 ` [Bug python/10826] " pmuldoon at redhat dot com
2009-11-03 13:44 ` pmuldoon at redhat dot com
2009-11-03 13:45 ` pmuldoon at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).