The Python API is pretty much a mirror of the C++ API's.  The process_events.py 
example: 
http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/process_events.py 
should give you a sense of how the broadcasters & listeners are used.  
Translating that from Python to C++ is quite straightforward.  There is some 
documentation in the SB API header files which can be helpful, though that is 
not complete.  There have been discussions on some of these issues on the 
mailing list previously that also might be of some help.

But you are right, we don't have a how-to manual for writing a debugger with 
the SB API's.  It would be great if somebody who was trying to use them for 
this purpose would draft up such a thing as they were going.  I am sure the 
folks on this list would be happy to help out and suggest better ways to do 
things, etc.

Jim

> On Feb 20, 2016, at 3:04 PM, Paul Peet via lldb-dev <lldb-dev@lists.llvm.org> 
> wrote:
> 
> Hello,
> 
> I am currently working on an IDE for C++ and I would like to integrate lldb 
> as a debugger using the C++ API but it has been difficult for me to 
> understand the architecture because there is no documentation available 
> (except doxygen which isn't helpful at all).
> I am at the point understanding the Event system? How are Events created?
> How can I use SBListener and SBBroadcaster? (What's the function of 
> SBBroadvaster).
> 
> My current code looks something like this:
> 
> SBListener listener;
> SBProcess process = target.Launch(listener, args, env, nullptr, nullptr,
>                                   nullptr, "/home/cynecx/dev/helloWorld",
>                                   0, true, error);
> 
> process.Continue();
> 
> StateType state = process.GetState(); // is stopped
> 
> SBEvent event;
> 
> while(true) {
>   if(listener.WaitForEvent(0xFFFFFFFF, event)) {
>     // This branch is never hit
>     SBStream stream;
>     event.GetDescription(stream);
>     std::cout << stream.GetData() << std::endl;
>   } else {
>     break;
>   }
> }
> 
> It would help developers (IDE) a lot if there might be some 
> tutorials/documentation on how to use the API.
> 
> Regards,
> Paul
> _______________________________________________
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to