This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] gdbpy_print_stack: Ensure output ends with a newline.
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Wed, 19 May 2010 16:35:08 -0700 (PDT)
- Subject: [commit] gdbpy_print_stack: Ensure output ends with a newline.
Hi.
I've checked this in.
While testing python-implemented gdb commands I found that
PyErr_Print doesn't necessarily end output with a newline.
This caused any subsequent the error message to appear on the same
line as the last line of the traceback.
2010-05-19 Doug Evans <dje@google.com>
* python.c (gdbpy_print_stack): Ensure output ends with a newline.
Index: python/python.c
===================================================================
RCS file: /cvs/src/src/gdb/python/python.c,v
retrieving revision 1.37
diff -u -p -r1.37 python.c
--- python/python.c 19 May 2010 21:57:24 -0000 1.37
+++ python/python.c 19 May 2010 23:31:44 -0000
@@ -416,7 +416,13 @@ void
gdbpy_print_stack (void)
{
if (gdbpy_should_print_stack)
- PyErr_Print ();
+ {
+ PyErr_Print ();
+ /* PyErr_Print doesn't necessarily end output with a newline.
+ This works because Python's stdout/stderr is fed through
+ printf_filtered. */
+ begin_line ();
+ }
else
PyErr_Clear ();
}