This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Python Scripting Question


>>>>> "scott" == scott snyder <snyder@fnal.gov> writes:

scott> FWIW, i've been using this patch.  This adds a function
scott> `gdb.execute_getoutput', which returns the output as a string.

scott> This probably isn't really the right way to do this ---
scott> I don't think this does the right thing with MI, and it has an ugly
scott> special case for TUI, but it's been working for me so far.

This looks reasonable.  However, I was planning to do it in a different
way.

In particular what I've been thinking is that we'd have a way to let the
user pass any pythonic output stream to gdb; either with explicit
commands to override the current output stream, or as an argument to
gdb.execute.  Handling MI-like output would work in a similar way, just
with a way to indicate that the new output stream is MI-like.

What do you think?  If that is too vague I can try to write up something
more documentation-like.

scott> +  if (uiout == tui_out)
scott> +    uiout = tui_old_uiout;

This sort of redirection probably belongs in a helper function in ui-out.

scott> +  /* Do any commands attached to breakpoint we stopped at.  */
scott> +  bpstat_do_actions ();

This could produce output.  Arguably it should be redirected as well.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]