[lldb-dev] Function tracing
jingham at apple.com
jingham at apple.com
Mon Feb 23 12:55:25 PST 2015
> On Feb 23, 2015, at 11:33 AM, Bruce Mitchener <bruce.mitchener at gmail.com> wrote:
>
> Jim,
>
> Thanks for all of this great info!
>
> Just two more questions for now ...
>
> On Tue, Feb 24, 2015 at 2:08 AM, <jingham at apple.com> wrote:
>
> > On Feb 22, 2015, at 7:42 PM, Bruce Mitchener <bruce.mitchener at gmail.com> wrote:
> > • Is all of this safe against re-entry? What happens if I'm trying X and X gets invoked again (during the thread plan execution)?
>
> The most straightforward way to do this would be to write something that just drives the event loop a la:
>
> http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/process_events.py
>
> Then recursion won't bother you. The step plans stack, so if you do your "step-out" and before the step out completes you hit the breakpoint again, that's okay, the first step-out plan is still on the plan stack. Do your "step-out" for the second breakpoint hit, and when that completes, "continue" and the original step-out plan will then get a chance to complete. And since plans are per thread, doing this on multiple threads won't cause any problems either.
>
> Ahh, I was going to do this from a command inside the LLDB CLI for now... Will that work well?
You will still have to do some event handling in your command, since you want to stop, run a bit, then stop again. But other than that it should be okay.
>
> Also, will this prevent other threads from running while I have a function trace happening? (The comments in the code about this aren't clear to me.)
The thread plans all have different policies about letting other threads run, and all the execution control commands should have a --run-mode option to control this behavior. In general, though, the default for all the plans will be to let all threads run whenever we're doing something that could run arbitrary amounts of code. For instance, step-out will generally let all threads run while doing the step-out.
If you actually want to suspend the other threads while tracing, and deal with deadlocks yourself, you can set the --run-mode to "this thread" or use "thread suspend/resume" manually (if those are supported on your platform.
Jim
>
> - Bruce
>
More information about the lldb-dev
mailing list