[lldb-dev] Better error message for attaching to a process already being debugged

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Thu Mar 10 12:56:17 PST 2016


> On Mar 9, 2016, at 5:40 PM, Jeffrey Tan <jeffrey.fudan at gmail.com> wrote:
> 
> Hi Greg, I am using the lldb(/usr/bin/lldb) installed by Xcode not self-built one. For example, I can use lldb to attach to chrome without any problem. And I can see the debugserver it uses is from "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver". Do I still need to sign it?

No, this one is code signed with an Apple certificate which is trusted by the system.

> Only the app launched from Xcode IDE can't be attached from this lldb.

Try using "xcrun lldb" instead of /usr/bin/lldb.

> 
> On Wed, Mar 9, 2016 at 3:08 PM, Greg Clayton <gclayton at apple.com> wrote:
> Did you follow the instructions and you have made your "lldb_codesign" code signing certificate?:
> 
> svn cat http://llvm.org/svn/llvm-project/lldb/trunk/docs/code-signing.txt
> 
> If you don't do this, your debugserver won't have the ability to debug anything. If you don't want to do this, you can remove the "debugserver" binary from your LLDB.framework that you built and are running with, and then we will fall back to using the one that is installed inside /Applications/Xcode.app as that one is Apple code signed.
> 
> Greg
> 
> > On Mar 9, 2016, at 3:04 PM, Jeffrey Tan via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> >
> > Hi,
> >
> > My colleague is trying to use our lldb IDE attaching to app run/build from Xcode which failed. I can reproduce this with lldb console:
> >
> > jeffreytan-mbp:$ ps aux | grep iOSApp
> > jeffreytan      61816   0.0  0.0  2432772    676 s002  S+    3:00PM   0:00.00 grep iOSApp
> > jeffreytan      61806   0.0  0.2  2721120  38600   ??  SXs   3:00PM   0:00.24 /Users/jeffreytan/Library/Developer/CoreSimulator/Devices/EF17E202-3981-4DB0-87C9-2A9345C1E713/data/Containers/Bundle/Application/CAEBA7D7-D284-4489-8A53-A88E56F9BB04/iOSAppTest.app/iOSAppTest
> > jeffreytan-mbp:$ lldb -p 61806
> > (lldb) process attach --pid 61806
> > error: attach failed: attach failed: unable to attach
> >
> > My theory is:
> > 1. Xcode does not have the concept of run without debugger and run under debugger, so it always run app with debugger enabled.(Is this true?)
> > 2. And you can't have two native debuggers debugging the same process on Mac(this is true on Windows, is it true for Mac or Linux?)
> >
> > If both are true, can we report meaningful message like "inferior is already being debugged" or something similar instead of the generic error message like "attach failed: unable to attach"?
> >
> > Btw: I found I can still use gdb to attach to the process(with a permission elevation dialog pop-up) and see the callstack. How does gdb do that?
> >
> > Jeffrey
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> 
> 



More information about the lldb-dev mailing list