/* If the input stream is connected to a terminal, turn on editing.
However, that is only allowed on the main UI, as we can only have
- one instance of readline. */
- if (ISATTY (ui->instream) && editing && ui == main_ui)
+ one instance of readline. Also, INSTREAM might be nullptr when
+ executing a user-defined command. */
+ if (ui->instream != nullptr && ISATTY (ui->instream)
+ && editing && ui == main_ui)
{
/* Tell gdb that we will be using the readline library. This
could be overwritten by a command in .gdbinit like 'set
}
}
+set test "define hello command"
+set commands "interpreter-exec mi3 \"-data-evaluate-expression 23\""
+gdb_test_multiple "define hello" "$test" {
+ -re "Type commands for definition of \"hello\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ pass "$test"
+ }
+}
+gdb_test "$commands\nend" "" "finish defining hello command"
+
+gdb_test "hello" [string_to_regexp "^done,value=\"23\""]
+
if ![runto_main] then {
return -1
}