================
@@ -675,19 +682,24 @@ StackFrameSP StackFrameList::GetFrameWithStackID(const
StackID &stack_id) {
StackFrameSP frame_sp;
if (stack_id.IsValid()) {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
uint32_t frame_idx = 0;
- // Do a binary search in case the stack frame is already in our cache
- collection::const_iterator begin = m_frames.begin();
- collection::const_iterator end = m_frames.end();
- if (begin != end) {
- collection::const_iterator pos =
- std::lower_bound(begin, end, stack_id, CompareStackID);
- if (pos != end) {
- if ((*pos)->GetStackID() == stack_id)
- return *pos;
+ {
+ // First see if the frame is already realized. This is the scope for
+ // the shared mutex:
+ std::shared_lock<std::shared_mutex> guard(m_list_mutex);
+ // Do a binary search in case the stack frame is already in our cache
+ collection::const_iterator begin = m_frames.begin();
+ collection::const_iterator end = m_frames.end();
+ if (begin != end) {
+ collection::const_iterator pos =
+ std::lower_bound(begin, end, stack_id, CompareStackID);
+ if (pos != end) {
+ if ((*pos)->GetStackID() == stack_id)
+ return *pos;
+ }
----------------
labath wrote:
```suggestion
collection::const_iterator pos =
llvm::lower_bound(m_frames, CompareStackID);
if (pos != m_frames.end() && (*pos)->GetStackID() == stack_id)
return *pos;
```
Optional, but would be a nice way to compensate for the increase in the nesting
level.
https://github.com/llvm/llvm-project/pull/117252
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits