Bug in tools/debugserver/source/RNBRemote.cpp

Hi,

Just as a preface, I’ve been attempting to get the codebase running under leopard and / or Linux. In the process, I’ve been using the makefiles. I’ve gotten to the point where I can run lldb under Leopard, but I can’t debug any programs because debugserver won’t build yet. While fixing small warnings / errors in the code base, I came across this piece of code at line 422 in tools/debugserver/source/RNBRemote.cpp:

The set of two while loops is not standard C and this looks alot like a deadlock possibility. I don’t know enough right now to fix this however.

Enjoy,
Bill Lynch

while ((set_events = events.WaitForSetEvents(events_to_wait_for)) != 0)
{
if (set_events & RNBContext::event_read_packet_available)
{
// Try the queue again now that we got an event
err = GetPacketPayload (payload);
if (err == rnb_success)
break;
}

if (set_events & RNBContext::event_read_thread_exiting)
err = rnb_not_connected;

if (err == rnb_not_connected)
return err;

} while (err == rnb_err);

Just change the:

        } while (err == rnb_err);

With:

  if (err == rnb_err)
    break;
        }