summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-12-10 12:00:32 -0800
committerDoug Evans <dje@google.com>2015-12-10 12:00:32 -0800
commit55145bb5e6cf17ed47f0674b2ddbde2d92aad4dc (patch)
tree14b6ec8db352ce266e1cac9eb0dcaf4f0d284186
parent9d012ecc23ad178944ec1bbb03b202cc73e73318 (diff)
downloadbinutils-gdb-55145bb5e6cf17ed47f0674b2ddbde2d92aad4dc.tar.gz
patch ../102430245.patch
-rw-r--r--README.google10
-rw-r--r--gdb/python/python.c10
-rw-r--r--gdb/testsuite/gdb.python/py-mi.exp14
3 files changed, 34 insertions, 0 deletions
diff --git a/README.google b/README.google
index 21bc65f784f..8b089b893b3 100644
--- a/README.google
+++ b/README.google
@@ -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.
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 5f03720d308..60a60a3b173 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -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"
diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp
index 94d114e6bfd..44c5009727b 100644
--- a/gdb/testsuite/gdb.python/py-mi.exp
+++ b/gdb/testsuite/gdb.python/py-mi.exp
@@ -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"
+}