This is the mail archive of the gdb-patches@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]

[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 ();
 }


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