This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Check that qLaunchGDBServer packet does not return an error
ClosedPublic

Authored by DavidSpickett on Jun 22 2023, 2:42 AM.

Details

Summary

While looking at https://github.com/llvm/llvm-project/issues/61955
I noticed that when we send qLaunchGDBServer we check that we got a response
but not what kind of response it was.

I think this was why the bug reporter saw:
(lldb) run
error: invalid host:port specification: '[192.168.64.2]'

The missing port is because we went down a path we only should have
chosen if the operation succeeded. Since we didn't check, we went ahead
with an empty port number.

To test this I've done the following:

  • Make a temporary copy of lldb-server.
  • Run that as a platform.
  • Remove the copy.
  • Attempt to create and run a target.

This fails because the running lldb-server will try to invoke itself
and it no longer exists.

Diff Detail

Event Timeline

DavidSpickett created this revision.Jun 22 2023, 2:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 2:42 AM
DavidSpickett requested review of this revision.Jun 22 2023, 2:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 2:42 AM

I was about to say I don't have a way to test this but I think I might have now.

Starting a platform, then moving lldb-server causes it to fail on Linux. Perhaps I can do that in an isolated way in a shell test.

Added a test from Python, which avoids a bunch of lit and Linux shell specific issues.

DavidSpickett edited the summary of this revision. (Show Details)Jun 22 2023, 3:48 AM

In the bug report the user didn't have a debugserver on the remote, but the handling is the same for lldb-server or debugserver.

jasonmolenda accepted this revision.Jun 29 2023, 2:59 PM

Ah, sorry for not getting back to this one! Nice job coming up with a test. LGTM.

This revision is now accepted and ready to land.Jun 29 2023, 2:59 PM