[lldb-dev] frontent for LLDB

Andrey Zaytsev andrey.zaytsev at jetbrains.com
Thu Jul 7 20:10:26 PDT 2011


On 07.07.2011, at 3:13, Greg Clayton wrote:

> 
> On Jul 6, 2011, at 2:27 PM, Andrey Zaytsev wrote:
> 
>> Hello everyone!
>> I'm working on lldb front-end for AppCode project. 
> 
> Great!
> 
>> I faced with real lack of documentation about API and I have question about SBListeners and SBEvents. I can't find a way to get information about subject of event. 
> 
> Johnny Chen is in the process of documenting our entire public API as we speak, so in a week or so we should have all of the documentation. 
> 
>> I received event about breakpoint change (eBroadcastBitBreakpointChanged). How can I get what's exactly changed.
> 
> Currently not much is exported through the public API. Internally the breakpoint that is changed currently can have data in the event that specifies:
> 
>        eBreakpointEventTypeAdded               = (1u << 1),
>        eBreakpointEventTypeRemoved             = (1u << 2),
> 
> And the event also contains the breakpoint that is affected. Currently you could just use the SBTarget breakpoint API to walk over all breakpoints and figure out if any were added/removed:
> 
>    uint32_t
>    SBTarget::GetNumBreakpoints () const;
> 
>    lldb::SBBreakpoint
>    SBTarget::GetBreakpointAtIndex (uint32_t idx) const;
> 
> Each breakpoint has a unique monotonically increasing integer identifier which can always be used to identify if the breakpoint is one that you have already seen and added to your UI. Each breakpoint also has zero or more locations (a breakpoint can have zero locations if you say have a breakpoint set at a function by name which will eventually appear in a shared library that has not yet been loaded). A breakpoint might suddenly get more locations as your program runs so you might want to use:
> 
>    size_t
>    SBBreakpoint::GetNumLocations() const;
> 
>    lldb::SBBreakpointLocation
>    SBBreakpoint::GetLocationAtIndex (uint32_t index);
> 
> to walk through all locations.
> 
> So really, just watch for these events and update your breakpoint list if it is visible.

Thank you. Very clear answer. 

> 
>> The same question is about Interrupt(eBroadcastBitInterrupt). How can I figure out what's the reason of interrupt.
> 
> This really isn't being used right now so you can ignore it!

About interruption reason I found this: 

      StopReason thread_stop_reason = thread.GetStopReason();

I think it's all i need to proceed.

> 
>> I can get answers by reading source code but it's quite complicated way ;-)
> 
> Yep! Keep asking questions if as you run into them and we will do our best to answer them!
> 
>> I found LLDB is really cool replacement of mess with gdb MI!
> 
> Happy to hear it!
> 
>> API is really self-describing but not in some semantics points. 
> 
> You can also check out how the Driver.cpp uses the API as an example (this is the command line driver).

This source file is very-very helpful. Looking into this when face some troubles. Thank you for this hint.

I will let you know when LLDB-frontend be available in AppCode. I think it is in a week or two. 
At the moment it can use only gdb. And here is another question. I'm not sure if you can answer it but anyway... We have device debug in our IDE with gdb. When lldb will be able to do this? And will this part of API be public? (I saw some ios-related code in lldb)

Thank you for helping us.






More information about the lldb-dev mailing list