xcode 为什么 LLDB Debugger 总是无法附加?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15174282/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why does the LLDB Debugger constantly fail to attach?
提问by Lithu T.V
I have seen a lot of answers for this question:
这个问题我看过很多答案:
error: failed to attach to process ID
错误:无法附加到进程 ID
as switch to GDB
. But no one addresses the reason of whyit happens?
作为switch to GDB
。但是没有人解释为什么会发生这种情况?
Attaching works fine with the GDB debugger but the default and recommended project setting is LLDB.
附加适用于 GDB 调试器,但默认和推荐的项目设置是 LLDB。
Can anybody explain why LLDB fails? Is it a common bug or am I doing something wrong?
谁能解释为什么 LLDB 失败?这是一个常见的错误还是我做错了什么?
Alternatively, how can I set GDB as my default debugger without changing it manually when creating the new projects?
或者,如何在创建新项目时将 GDB 设置为我的默认调试器而无需手动更改它?
System Info:
系统信息:
OS: Lion
RAM: 5GB
XCode: Version 4.6 (4H127)
Device: Mac mini
My localhost setting:
我的本地主机设置:
回答by trojanfoe
Make sure you have localhost
mapped to 127.0.0.1
in your /etc/hosts
file:
确保您已在文件中localhost
映射到:127.0.0.1
/etc/hosts
$ grep localhost /etc/hosts
If grep
doesn't show 127.0.0.1
then add it:
如果grep
没有显示,127.0.0.1
则添加它:
$ sudo -i # echo "127.0.0.1 localhost" >> /etc/hosts
^ That '#' is root's command prompt; don't type it otherwise you will comment-out the statement and nothing will happen
^ '#' 是 root 的命令提示符;不要输入它,否则你会注释掉语句,什么都不会发生
NOTEUse >>
and not >
! (better is to edit it using vi
or mate
or whatever).
注意使用>>
而不是>
!(更好的是使用vi
或mate
或其他方式编辑它)。
My /etc/hosts
file shows (ignoring comments):
我的/etc/hosts
文件显示(忽略评论):
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
回答by Black Frog
Apple likes to move forward. So setting gdb as the debugger for all new projects is not an option.
苹果喜欢前进。因此,不能将 gdb 设置为所有新项目的调试器。
Sometimes, you have to reset the iOS Simulatorto clean up the debugger.
有时,您必须重置iOS 模拟器以清理调试器。