[Lldb-commits] [PATCH] D22081: Use shell cat command as a workaround if ADB stat cannot lookup a file

Oleksiy Vyalov via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 7 18:47:10 PDT 2016


ovyalov added a comment.

In http://reviews.llvm.org/D22081#476766, @labath wrote:

> You raised good points here, Luke.
>
> I've thought about the quoting issue, but as you have already noticed there is no way to pass arguments containing quotes to adb correctly. Thinking about it more, what we could do is detect this situation (look for `'` in the file name) and abort the whole process even before issuing the "adb shell" command.
>
> As for the return value, this should not be a big problem, as further down the line we will discover that this is not a real ELF file and ignore it, but perhaps we could help here by searching for the file name in the first 1K bytes of the result, and ignoring the file if we find it?
>
> Oleksiy, what do you think?


Initially I was thinking that we can pass any shell output to the caller so either module cache or ELF ObjectFile will verify its correctness - but since Platform::GetFile can be used to download an arbitrary file we should try to handle execution errors as much as we can. I added for "/system/bin/sh:" output prefix check - presumably it should cover majority of failures. As an alternative we can run a command like "$user_cmd || echo $rand_id" and then look whether output ends with $rand_id - but it might be an overkill.


http://reviews.llvm.org/D22081





More information about the lldb-commits mailing list