Log XCode gdb output to file with .gdbinit

2019-05-28 00:13发布

I'm try to redirect gdb output from XCode to a log file for automated testing. I've automated the process of running an app for testing using AppleScript, but I need to be able to see the output. I've tried using the .gdbinit file with

set logging file <filepath>
set logging overwrite on
set logging on

but I get “warning: Current output protocol does not support redirection” in my log file. A bit of searching for this error message didn't turn up much, besides a mention of a problem with "TUI-mode." If this is the problem, how do I turn off TUI-mode in XCode? If not, what is causing that warning?

2条回答
疯言疯语
2楼-- · 2019-05-28 00:40

As per an answer to this question: Redirecting debug output from XCode 4 console to a log file

You can use this system default to log Xcode's GDB output to a file:

defaults write com.apple.dt.Xcode IDEGDBLogToFile /tmp/logs.txt

It works for me with Xcode 4.2. Just make sure to restart Xcode after you set that default.

查看更多
聊天终结者
3楼-- · 2019-05-28 00:54

Try adding this to the top of your .gdbinit:

set logging redirect off
查看更多
登录 后发表回答