From: Doug Evans Date: Thu, 10 Dec 2015 20:00:32 +0000 (-0800) Subject: patch ../102430245.patch X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55145bb5e6cf17ed47f0674b2ddbde2d92aad4dc;p=thirdparty%2Fbinutils-gdb.git patch ../102430245.patch --- 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 ++ ++ * 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" +}