[lldb-dev] delay during continue after attach on Mac OS X

Greg Clayton gclayton at apple.com
Fri May 24 17:31:59 PDT 2013


One issue we have to watch out for is that the process has the notion of a public state (stopped/running/exited). The process state doesn't update until your consume the process events that say "process has stopped". So if you do code like:

pid_t pid = 123;
SBAttachInfo attach_info(pid);
SBError error;
SBProcess process = target.Attach (attach_info, error);

even in the process is stopped, internally, the public facade of "SBProcess" won't update its state until you consume the process event that says the process is stopped. 

There are two ways to fix this:
1 - Make sure to consume the process events so the public process state gets updated. 
2 - Set the async debugging to false to enable synchronous debugging and the events will be consumed for you.

If you are telling LLDB to continue after attaching and the public state is still "eStateAttaching", the continue will just get ignored.

Greg Clayton

On May 24, 2013, at 2:09 PM, "Malea, Daniel" <daniel.malea at intel.com> wrote:

> Hi Arthur,
> 
> I'm afraid I haven't run into the problem you describe specifically. Might
> it be similar to this open (Linux) bug though?
> http://llvm.org/bugs/show_bug.cgi?id=16039
> 
> Also, I'm copying lldb-dev list with your question; maybe someone there
> has more experience on Mac OS X..
> 
> 
> Dan
> 
> On 2013-05-23 7:25 PM, "Arthur Evstifeev" <ap4y at me.com> wrote:
> 
>> Hi Daniel,
>> 
>> I wanted to ask something about lldb implementation of the --continue
>> flag for process commands. Specifically, maybe you know have can I
>> achieve the same behaviour from python API.
>> 
>> When I'm invoking from python Continue method on process instance after
>> attaching,
>> actual process is not continuing, after slight delay process is stopping
>> and I have to invoke
>> continue manually. But when I'm attaching from console lldb with -c flag
>> it's actually continue as expected, but there is a noticeable delay
>> between process stopped and process continued messages in console. So,
>> from this console log messages it seems like lldb is waiting till
>> process stops and then invoking continue. Maybe you have ideas how I can
>> implement similar behaviour?
>> 
>> Cheers,
>> Arthur
>> 
>> On 05/23, Malea, Daniel wrote:
>>> Hi Arthur, thanks for the new functionality; I will try it out today and
>>> let you know how it goes!
>>> 
>>> Do you mind also adding a few words in utils/vim-lldb/doc/lldb.txt for
>>> the
>>> new commands? I like to keep the help page in sync :)
>>> 
>>> 
>>> Cheers,
>>> Dan
>>> 
>>> On 2013-05-22 6:57 PM, "Arthur Evstifeev" <ap4y at me.com> wrote:
>>> 
>>>> Hi Daniel,
>>>> 
>>>> Thanks for the response and accepting patches. I have implemented
>>> couple
>>>> small additions that we discussed:
>>>> 
>>>> 1. Added new :Lpo command
>>>> 2. :Lpo and :Lprint can be invoked without parameters. In that case
>>>> cursor word will be used
>>>> 3. Added :LpO command in that case instead of <cword> will be used
>>>> stripped <cWORD>. This command is useful for printing objective-c
>>>> properties (for ex.: self.tableView). I think alternative :Lprint
>>>> command with cWORD will be useful too (for structs and cpp accessors),
>>>> but couldn't come up with meaningful alias.
>>>> 
>>>> Thanks again!
>>>> 
>>>> On 05/22, Malea, Daniel wrote:
>>>>> Sweet! I'm glad it's working out for you. I committed your
>>> improvements
>>>>> in
>>>>> 182483 and 182484!
>>>>> 
>>>>> I'm not too familiar with Objective-C but anything that helps out
>>> with
>>>>> that is that is welcome. Are you thinking of adding a ":Lpo" option?
>>>>> 
>>>>> As for the :Lprint under cursor thing, I've been meaning to implement
>>>>> something like that myself but have not gotten around to it. If you
>>> have
>>>>> improvements, please send patches and I will commit post haste!
>>>>> 
>>>>> 
>>>>> Cheers,
>>>>> Dan
>>>>> 
>>>>> On 2013-05-21 10:47 PM, "Arthur Evstifeev" <ap4y at me.com> wrote:
>>>>> 
>>>>>> Hi Daniel,
>>>>>> 
>>>>>> Thanks for the lldb plugin, this plugin is so helpful for me. I
>>>>>> have missed couple function though, so I implemented them and want
>>> to
>>>>>> contribute them.
>>>>>> 
>>>>>> I'm using this plugin for iOS development. Since such apps only work
>>>>>> under simulator process, current target-centric plugin architecture
>>>>>> doesn't fit well. I added attach and detach operations, that
>>>>>> don't require target instance (empty target will be created during
>>>>>> attach). 
>>>>>> 
>>>>>> Also I found myself several time in situation when I wanted to close
>>>>>> plugin panes, but it's really hard to restore them all at once. So I
>>>>>> allowed to invoke Lshow without parameters. In that case all panes
>>> will
>>>>>> be restored.
>>>>>> 
>>>>>> I wanted to ask what do you think about adding additional
>>> objective-c
>>>>>> specific printing command ("po", which is alias to "expression -o")?
>>>>> This
>>>>>> is
>>>>>> a most used command for objective-c developers. Also I found very
>>>>>> useful macro for :Lprint word under cursor. What do you think about
>>>>> this
>>>>>> additions? I can send patches for this operations too.
>>>>>> 
>>>>>> Thanks,
>>>>>> Arthur
>>>>> 
>>> 
> 
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev




More information about the lldb-dev mailing list