Page MenuHomePhabricator

Implement and use adb push for PlatformAndroid::PutFile
ClosedPublic

Authored by flackr on May 22 2015, 11:48 AM.

Details

Summary

Using the adb push protocol is significantly faster than the current method of sending the hex encoded file data for the remote to write to the file.

Diff Detail

Repository
rL LLVM

Event Timeline

flackr updated this revision to Diff 26334.May 22 2015, 11:48 AM
flackr retitled this revision from to Implement and use adb push for PlatformAndroid::PutFile.
flackr updated this object.
flackr edited the test plan for this revision. (Show Details)
flackr added a reviewer: tberghammer.
flackr set the repository for this revision to rL LLVM.
flackr added a subscriber: Unknown Object (MLST).

Please see my comments.

source/Plugins/Platform/Android/AdbClient.cpp
44 ↗(On Diff #26334)

Please check how it works on Windows - https://github.com/llvm-mirror/lldb/blob/master/include/lldb/Host/windows/win32.h resets S_IRWXU and S_IRWXG to 0, we may want to define just numeric constants here instead.

306 ↗(On Diff #26334)

stringstream::str returns copy of string - could you store file_description.str() as temp variable in order to reuse for length() and c_str() ?

311 ↗(On Diff #26334)

Do we need to fail if src.read(chunk, kMaxPushData).bad() returns true?

317 ↗(On Diff #26334)

You may use FileSpec::GetModificationTime here to get source lmt.

flackr updated this revision to Diff 26518.May 26 2015, 9:52 AM
  • Get modification time for adb push from source file (Pass FileSpec directly through)
  • Hard-code file mode flags (to not rely on platform definitions)
  • Return failure if a failure occurs reading the source file.
source/Plugins/Platform/Android/AdbClient.cpp
44 ↗(On Diff #26334)

Lets just define the numeric constant, done.

306 ↗(On Diff #26334)

Done.

311 ↗(On Diff #26334)

Done.

317 ↗(On Diff #26334)

Done.

tberghammer accepted this revision.May 26 2015, 10:05 AM
tberghammer edited edge metadata.

LGTM

source/Plugins/Platform/Android/AdbClient.cpp
43 ↗(On Diff #26518)

Please add a comment about what this number means (e.g.: list the symbolic constants in a comment)

318 ↗(On Diff #26518)

(nit) nullptr

This revision is now accepted and ready to land.May 26 2015, 10:05 AM
ovyalov accepted this revision.May 26 2015, 11:55 AM
ovyalov added a reviewer: ovyalov.

Looks good.

source/Plugins/Platform/Android/AdbClient.h
54 ↗(On Diff #26518)

For the consistency of interface will need to make PutFile to take FileSpecs as parameters - no need to do this now, I can clean it up later.

flackr updated this revision to Diff 26569.May 26 2015, 7:19 PM
flackr edited edge metadata.
  • Comment constant
  • Use nullptr
source/Plugins/Platform/Android/AdbClient.cpp
43 ↗(On Diff #26518)

Done.

318 ↗(On Diff #26518)

Done.

This revision was automatically updated to reflect the committed changes.