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
818 stars 218 forks source link

how to use 1> to redirect gdb output in vscode inter terminal #1340

Open lingr7 opened 2 years ago

lingr7 commented 2 years ago

now show like

 "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm}  0<"/tmp/Microsoft-MIEngine-In-0qwl315s.ozd" 1>"/tmp/Microsoft-MIEngine-Out-eywsucjm.nmj"

I want to redirect the output to logfile, how can I do this? but the 1> is used by Microsoft-MIEngine

WardenGnaw commented 2 years ago

In your launch.json's setupCommands you want to add:

"setupCommands": [ 
   { 
      "text": "set logging on", 
      "description": "Enable File Logging", 
      "ignoreFailures": false 
   },
   { 
      "text": "set logging file logfile.log", 
      "description": "Log GDB Output to logfile.log", 
      "ignoreFailures": false 
   },
]

See https://sourceware.org/gdb/onlinedocs/gdb/Logging-Output.html

lingr7 commented 2 years ago

sorry, maybe my descript is not clear. Why I think use 1 > is I want to get the terminal show things(but not the gdb level log). now I find our own program itself has done save our set log to file, but the file does not include the result printf() and the depend library's log show in run in terminal.So I want to save what I can see in terminal to file to use like grep to find what I care about in this run.

lingr7 commented 2 years ago

In launch.json's setupCommands now has

{
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }