Skip to content
  • Greg Clayton's avatar
    SBFrame is now threadsafe using some extra tricks. One issue is that stack · b9556acc
    Greg Clayton authored
    frames might go away (the object itself, not the actual logical frame) when
    we are single stepping due to the way we currently sometimes end up flushing
    frames when stepping in/out/over. They later will come back to life 
    represented by another object yet they have the same StackID. Now when you get
    a lldb::SBFrame object, it will track the frame it is initialized with until 
    the thread goes away or the StackID no longer exists in the stack for the 
    thread it was created on. It uses a weak_ptr to both the frame and thread and
    also stores the StackID. These three items allow us to determine when the
    stack frame object has gone away (the weak_ptr will be NULL) and allows us to
    find the correct frame again. In our test suite we had such cases where we
    were just getting lucky when something like this happened:
    
    1 - stop at breakpoint
    2 - get first frame in thread where we stopped
    3 - run an expression that causes the program to JIT and run code
    4 - run more expressions on the frame from step 2 which was very very luckily
        still around inside a shared pointer, yet, not part of the current 
        thread (a new stack frame object had appeared with the same stack ID and
        depth). 
        
    We now avoid all such issues and properly keep up to date, or we start 
    returning errors when the frame doesn't exist and always responds with
    invalid answers.
    
    Also fixed the UserSettingsController  (not going to rewrite this just yet)
    so that it doesn't crash on shutdown. Using weak_ptr's came in real handy to
    track when the master controller has already gone away and this allowed me to
    pull out the previous NotifyOwnerIsShuttingDown() patch as it is no longer 
    needed.
    
    llvm-svn: 149231
    b9556acc
Loading