microsoft/MIEngine

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

lingr7 opened this issue · 3 comments

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

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

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.

In launch.json's setupCommands now has

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