Bug 17507 - GDB-MI interpreter should use "console-stream" records for monitor command results
Summary: GDB-MI interpreter should use "console-stream" records for monitor command re...
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: mi (show other bugs)
Version: 7.6
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-23 15:52 UTC by Teodor Madan
Modified: 2018-04-01 17:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Teodor Madan 2014-10-23 15:52:21 UTC
When executing "monitor help", reply from gdbserver is reported as "target-stream" thus it will be routed to console/tty associated with debugged application. It is expected to be printed to console-stream being a result of CLI command.
A gdb/mi frontend (e.g. eclipse) will route stream records to different console views depending on the record type. 

The undesirable effect in this situation: user will enter a gdb command in gdb shell console and will see result in a totally different console. 

In low-level GDB jtag debugging user has to interact often with "monitor" commands due to a lot of very specialized extensions. 

---------------steps to reproduce -------------
1. start "gdbserver  -multi :2345"
2. start gdb with mi interpretter: "gdb --interpretter=mi"

(gdb)
target extended-remote :2345
&"target extended-remote :2345\n"
~"Remote debugging using :2345\n"
=tsv-created,name="trace_timestamp",initial="0"\n
^done
(gdb)
mon set debug-hw-points 1
&"mon set debug-hw-points 1\n"
@"H/W point debugging output enabled.\n"
^done
(gdb)

Inspect result of the command. It does start with "@" as a sign of a stdout activity of debugged application, not "~" that would mean that it is a string dedicated to be displayed to whoever sent that command.

-------------

According to chapter "27.5.2 gdb/mi Output Syntax",

"console-stream-output is output that should be displayed as is in the console. It is the textual response to a CLI command. All the console output is prefixed by ‘~’."

"target-stream-output is the output produced by the target program. All the target output is prefixed by ‘@’."

An optional gdb set subcommand would work as well. e.g. "set remoteshell 1"