]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
patch ../102430245.patch
authorDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:32 +0000 (12:00 -0800)
committerDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:32 +0000 (12:00 -0800)
README.google
gdb/python/python.c
gdb/testsuite/gdb.python/py-mi.exp

index 21bc65f784fb6cecf429dfbf850ddb310d8d82c3..8b089b893b38bd8ca3de3ab8b839cfda850a830b 100644 (file)
@@ -271,3 +271,13 @@ they are an ongoing maintenance burden.
 +
 +      testsuite/
 +      * gdb.base/dprintf-detach.exp: Cope with local patch. Ref# 2180247
+--- README.google      2015-09-05 18:55:44.000000000 -0700
++++ README.google      2015-09-05 18:59:16.000000000 -0700
++
++2015-09-05  Doug Evans  <dje@google.com>
++
++      * python/python.c (gdbpy_top_interpreter_is_mi): New function.
++      (GdbMethods): New member top_interpreter_is_mi.
++
++      testsuite/
++      * gdb.python/py-mi.exp: Add tests for gdb.top_interpreter_is_mi.
index 5f03720d3084edd7b3903d882959904be771a218..60a60a3b173e37734ccdb3f01dda3741d5119aa4 100644 (file)
@@ -1541,6 +1541,16 @@ gdbpy_free_type_printers (const struct extension_language_defn *extlang,
   do_cleanups (cleanups);
 }
 
+/* Return True if the top interpreter is MI-like.  */
+
+static PyObject *
+gdbpy_top_interpreter_is_mi (PyObject *unused1, PyObject *unused2)
+{
+  if (ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ())))
+    Py_RETURN_TRUE;
+  Py_RETURN_FALSE;
+}
+
 #else /* HAVE_PYTHON */
 
 /* Dummy implementation of the gdb "python-interactive" and "python"
index 94d114e6bfd3a0b65176c8fefdffea44867a576f..44c5009727b378289cfc0830a95586a6e4211960 100644 (file)
@@ -356,3 +356,17 @@ mi_list_varobj_children fake.private {
 
 mi_gdb_test "-var-set-visualizer fake.private gdb.default_visualizer" \
     "\\^done" "Install visualizer on a cplus_fake_child"
+
+# Test top_interpreter_is_mi.
+
+gdb_exit
+gdb_start
+gdb_test "python print gdb.top_interpreter_is_mi()" "False" \
+  "top_interpreter_is_mi when false"
+
+gdb_exit
+if ![mi_gdb_start] {
+    mi_gdb_test "python print gdb.top_interpreter_is_mi()" \
+       ".*~\"True\\\\n\"\r\n\\^done" \
+       "top_interpreter_is_mi when true"
+}