[lldb-dev] SBTarget::Launch return SBProcess with PID=0

Eran Ifrah eran.ifrah at gmail.com
Tue Apr 1 12:34:45 PDT 2014


Thanks. I decided to debug it and see where it fails. So I built
liblldb.3.5.0.dylib in debug mode and debugged the Launch function...

It turns out that it requires the debugserver and it assumes that it exists
under LLDB.framework/
however, I have no such directory within my cmake build :P

Now, "my" debugserver executable terminates immediately after execution:

$debugserver
killed: 9
$
Running it under the debugger shows nothing significant (I will try to dig
into this later also...)

However, if set this environment variable ( which I learnt about while
debugging ) within codelite:
LLDB_DEBUGSERVER_PATH=/Path/To/CommandLineTools/PrivateFrameworks/LLDB.framework/Resources/debugserver

The process launches successfully and I get a valid process ID (Hooray!)


So a question to you guys:
How do I create a framework out of the build? Is this done manually? (i.e.
should I simply create the directory structure and copy the relevant files
to their respective location?)
Sorry for all the noobish questions, its just my OSX knowledge is very
limited compared to Linux/Windows
But I am working on it ;)

P.S.
This is how I built LLDB ( I am using the command line and not Xcode for
that purpose) :

- svn checkout llvm
- cd llvm/tools
- svn checkout lldb
- svn checkout clang
- mkdir build-debug && cd build-debug
- cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug
- ninja

I also followed the signing process as described here
http://llvm.org/svn/llvm-project/lldb/trunk/docs/code-signing.txt

P.P.S
I really hope that this mailing list is archived somewhere on the web so
someone else who wishes to implement LLDB plugin for <choose the IDE name>
will benefit for my noob questions

Thanks,
Eran




On Tue, Apr 1, 2014 at 9:43 PM, Greg Clayton <gclayton at apple.com> wrote:

> The easiest way to see what is going on is to enable gdb-remote packet
> logging. Make sure you tell Codelight to source the init files when you
> create your debugger:
>
> // Init LLDB
> SBDebugger::Initialize();
>
> // Create debugger
> bool source_init_files = true;
> SBDebugger debugger = SBDebugger::Create(source_init_files);
>
> Then add the following line to your ~/.lldbinit file:
>
> log enable -f /tmp/packets.txt gdb-remote packets
>
> Then run and watch your pid come back with zero. Quit code light and
> attach the packets.txt file to a reply email and we can see what is going
> on.
>
> Did you follow the code signing instructions? You might want to verify
> that your command line LLDB can indeed debug something:
>
> % ./lldb /bin/ls
> (lldb) process launch
>
>
> Make sure it completes successfully.
>
>
>
> On Apr 1, 2014, at 1:19 AM, Eran Ifrah <eran.ifrah at gmail.com> wrote:
>
> > Hello,
> >
> > I have passed most of the barriers I had in order to integrate lldb
> within codeite and I have started testing the code on OSX.
> > I have OSX 10.9 and I compiled lldb (btw, an enforcement in CMake to
> ensure that Xcode is installed would be nice)
> > When I start debugging from within codelite using lldb, the call to
> m_target.Launch(...) where (m_target is of type SBTarget) returns a valid
> SBProcess, i.e. m_target.Launch().IsValid() is true
> >
> > However, calling m_target.GetProcess().GetProcessID() returns 0
> > Doing "ps -ef|grep TestLLDB" in the Terminal.app shows that the debuggee
> process was indeed launched ( I can confirm that the parent process is
> codelite)
> >
> > Any ideas why it may return 0?
> >
> > TIA,
> >
> > --
> > Eran Ifrah
> > Author of codelite, a cross platform open source C/C++ IDE:
> http://www.codelite.org
> > wxCrafter, a wxWidgets RAD: http://wxcrafter.codelite.org
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>


-- 
Eran Ifrah
Author of codelite, a cross platform open source C/C++ IDE:
http://www.codelite.org
wxCrafter, a wxWidgets RAD: http://wxcrafter.codelite.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140401/e6363b18/attachment.html>


More information about the lldb-dev mailing list