Why does the LLDB Debugger constantly fail to attach?

可紊 提交于 2019-11-29 17:07:09

问题


I have seen a lot of answers for this question:

error: failed to attach to process ID

as switch to GDB. But no one addresses the reason of why it happens?

Attaching works fine with the GDB debugger but the default and recommended project setting is LLDB.

Can anybody explain why LLDB fails? Is it a common bug or am I doing something wrong?

Alternatively, how can I set GDB as my default debugger without changing it manually when creating the new projects?

System Info:

OS: Lion
RAM: 5GB
XCode: Version 4.6 (4H127)
Device: Mac mini

My localhost setting:


回答1:


Make sure you have localhost mapped to 127.0.0.1 in your /etc/hosts file:

$ grep localhost /etc/hosts

If grep doesn't show 127.0.0.1 then add it:

$ 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

NOTE Use >> and not >! (better is to edit it using vi or mate or whatever).

My /etc/hosts file shows (ignoring comments):

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost



回答2:


Apple likes to move forward. So setting gdb as the debugger for all new projects is not an option.

Sometimes, you have to reset the iOS Simulator to clean up the debugger.



来源:https://stackoverflow.com/questions/15174282/why-does-the-lldb-debugger-constantly-fail-to-attach

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!