This is an archive of the discontinued LLVM Phabricator instance.

Fix error handling in AdbClient - PushFile and PullFile
ClosedPublic

Authored by ovyalov on Jun 1 2015, 7:01 PM.

Details

Reviewers
labath
Summary

PushFile - fixed DONE response handling.
PullFile - fixed RECV response handling.
Added STAT request.

Diff Detail

Event Timeline

ovyalov updated this revision to Diff 26950.Jun 1 2015, 7:01 PM
ovyalov retitled this revision from to Fix error handling in AdbClient - PushFile and PullFile.
ovyalov updated this object.
ovyalov edited the test plan for this revision. (Show Details)
ovyalov added a reviewer: labath.
ovyalov added a subscriber: Unknown Object (MLST).
labath added inline comments.Jun 2 2015, 2:45 AM
source/Plugins/Platform/Android/AdbClient.cpp
272

This will fail if the file exists but is of zero size. In any case, I don't think the solution is to do a stat() before we attempt the transfer, since there are lots of ways the transfer can go south even if the stat call succeeds (file has wrong permissions, file has been removed in the mean time, uncorrectable read error, connection got terminated, ...). Adb already sends us the exact error that occurred in response to the RECV command, but we fail to parse it out for some reason. For example, if I remove the read permission on the file, adb sends the 'Permission denied' error, but for some reason we end up displaying:

get-file failed: Failed to read file chunk: Got unexpected response id from adb: "issi"

The "issi" string is actually the substring of the "Permission denied", so it looks there there is some error in the protocol parsing. Isn't it possible to do something similar as in the PushFile implementation?

ovyalov added inline comments.Jun 2 2015, 11:56 AM
source/Plugins/Platform/Android/AdbClient.cpp
272

I traced STAT command used by adb pull by missed that RECV command may have FAIL response with error message - fixed that.
Left Stat as-is since it's already implemented and if somebody will need it in future.

ovyalov updated this revision to Diff 26995.Jun 2 2015, 11:58 AM
ovyalov updated this object.

Addressed review comments.

labath accepted this revision.Jun 4 2015, 5:56 PM
labath edited edge metadata.

LGTM, thanks.

This revision is now accepted and ready to land.Jun 4 2015, 5:56 PM
ovyalov closed this revision.Jun 4 2015, 6:37 PM

AFFECTED FILES

/lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
/lldb/trunk/source/Plugins/Platform/Android/AdbClient.h

USERS

ovyalov (Author)

http://reviews.llvm.org/rL239130