This is an archive of the discontinued LLVM Phabricator instance.

Handle old style 'S' packet correctly
ClosedPublic

Authored by bhushan on Jul 22 2015, 11:16 PM.

Details

Reviewers
clayborg
Summary

This patch fixes couple of issues described below:

  1. A thread tries to lock a mutex which is already locked. This happens in ProcessGDBRemote.cpp

ProcessGDBRemote::RefreshStateAfterStop ()

    • locks m_last_stop_packet_mutex
    • access packet stack to get the stop info and
    • call SetThreadStopInfo(stop_info)
  • calls UpdateThreadIDList() to get the thread list if the response is old style 'S' packet which does not provide the thread information.
		  This causes a problem because UpdateThreadIDList() again tries to aquire a lock on m_last_stop_packet_mutex (which is already locked).

This patch fixes this issue by changing the Type of m_last_stop_packet_mutex to eMutexTypeRecursive so that the same thread can enter the mutex recursively.

  1. The old style 'S' packet isn't handled correctly.

This patch fixes this issue by updating a thread list before the stop packet is parsed so that it can get a valid thread id and allows to set the stop info correctly.

Diff Detail

Repository
rL LLVM

Event Timeline

bhushan updated this revision to Diff 30450.Jul 22 2015, 11:16 PM
bhushan retitled this revision from to Handle old style 'S' packet correctly.
bhushan updated this object.
bhushan added a reviewer: clayborg.
bhushan set the repository for this revision to rL LLVM.
bhushan added subscribers: lldb-commits, jaydeep, slthakur and 2 others.
clayborg accepted this revision.Jul 23 2015, 1:59 PM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Jul 23 2015, 1:59 PM
bhushan closed this revision.Aug 13 2015, 10:18 PM

Closed by Commit rL243091