diff options
author | Michał Górny <mgorny@moritz.systems> | 2021-08-09 21:25:18 +0200 |
---|---|---|
committer | Michał Górny <mgorny@moritz.systems> | 2021-09-10 11:09:35 +0200 |
commit | 21e2d7ce43c42df5d60a2805c801b8f1eda7919c (patch) | |
tree | 65215c157754b83f3fd24df707a6bd4ae5478a0d /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h | |
parent | 7d42eb3af7792fc3e8429f8a1581fd8c7dc5e7f5 (diff) | |
download | llvm-21e2d7ce43c42df5d60a2805c801b8f1eda7919c.zip llvm-21e2d7ce43c42df5d60a2805c801b8f1eda7919c.tar.gz llvm-21e2d7ce43c42df5d60a2805c801b8f1eda7919c.tar.bz2 |
[lldb] [gdb-remote] Implement fallback to vFile:stat for GetFileSize()
Implement a fallback to getting the file size via vFile:stat packet
when the remote server does not implement vFile:size. This makes it
possible to query file sizes from remote gdbserver.
Note that unlike vFile:size, the fallback will not work if the server is
unable to open the file.
While at it, add a few tests for the 'platform get-size' command.
Differential Revision: https://reviews.llvm.org/D107780
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index 0062508..f1a78ce 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -376,6 +376,12 @@ public: bool CloseFile(lldb::user_id_t fd, Status &error); + llvm::Optional<GDBRemoteFStatData> FStat(lldb::user_id_t fd); + + // NB: this is just a convenience wrapper over open() + fstat(). It does not + // work if the file cannot be opened. + llvm::Optional<GDBRemoteFStatData> Stat(const FileSpec &file_spec); + lldb::user_id_t GetFileSize(const FileSpec &file_spec); void AutoCompleteDiskFileOrDirectory(CompletionRequest &request, @@ -581,7 +587,7 @@ protected: m_supports_QEnvironment : 1, m_supports_QEnvironmentHexEncoded : 1, m_supports_qSymbol : 1, m_qSymbol_requests_done : 1, m_supports_qModuleInfo : 1, m_supports_jThreadsInfo : 1, - m_supports_jModulesInfo : 1; + m_supports_jModulesInfo : 1, m_supports_vFileSize : 1; /// Current gdb remote protocol process identifier for all other operations lldb::pid_t m_curr_pid = LLDB_INVALID_PROCESS_ID; |