microsoft / MIEngine

The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.
MIT License
813 stars 219 forks source link

Extraneous debugger output #452

Open Dmitri-Botcharnikov opened 7 years ago

Dmitri-Botcharnikov commented 7 years ago

MIEngine copies all debugger output to Debug Output window in Visual Studio:

settings set target.move-to-nearest-code false
=thread-selected,id="1"
Loaded '[vdso]'. Cannot find or open the symbol file.
 location added to breakpoint 2
 location added to breakpoint 3
 location added to breakpoint 4
@"Hello, World!\r\n"
@"Hello, World2!\r\n"

Is it possible to leave only debugged program output (prefixed with '@')?

gregg-miskelly commented 7 years ago

@Dmitri-Botcharnikov: I know that at least for several versions of GDB, program output will not get the '@' prefix. So I don't think we would ever want to do this by default. Maybe we could have some way to achieve this though...

Dmitri-Botcharnikov commented 7 years ago

@gregg-miskelly: Could we do this at least for LLDB mode? If you point me where to look in source code, I can try to prepare patch.

gregg-miskelly commented 7 years ago

@pieandcakes, @Dmitri-Botcharnikov do you know if LLDB will always use the '@'?

Dmitri, I believe the code that will receive those is here: https://github.com/Microsoft/MIEngine/blob/5608ce58b026e605153e7c60fb4f24898a4df67b/src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs#L86

One thought -- Visual Studio has some support for filtering debug output window content if you right click on the output window: output filtering options

Maybe we could put non-'@' prefixed messages in one of those categories so that one can remove it. If we wanted to do is that way, we would switch to using 'OnOutputMessage' instead of 'OnOutputString' and use one of the enum_MESSAGETYPE120.MT_REASON_* values for MessageType.

pieandcakes commented 7 years ago

@gregg-miskelly In our VSCode instance, if externalConsole is set to true, the output in the terminal window does not have @ sign. If it is set to false, all output in the debug Console has the @ sign.

Dmitri-Botcharnikov commented 7 years ago

@gregg-miskelly: LLDB-MI prefixes all process' stdout & stderr with '@' before displaying prompt so I think it's the safe assumption. We're using MIEngine with remote lldb-mi through plink.exe utility and in this scenario it seems that _connected is always false and we never reach OnOutputString.

Trass3r commented 4 years ago

For me there are also & prefixes for internal debug messages:

1: (12074) <-1051-exec-step
1: (12074) ->1051^running
1: (12075) ->*running,thread-id="all"
1: (12076) ->&"26479.073519 skip: checking if file /usr/include/c++/9/bits/unique_ptr.h matches glob /usr/include/c++/*/*/*...\n"
1: (12076) ->&"26479.073537 yes.\n"
1: (12076) ->*stopped,reason="end-stepping-range"...