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/GDBRemoteCommunication.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/GDBRemoteCommunication.h')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index b1e2075..967dc82 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -51,6 +51,26 @@ enum class CompressionType { LZMA, // Lempel–Ziv–Markov chain algorithm }; +// Data included in the vFile:fstat packet. +// https://sourceware.org/gdb/onlinedocs/gdb/struct-stat.html#struct-stat +struct GDBRemoteFStatData { + llvm::support::ubig32_t gdb_st_dev; + llvm::support::ubig32_t gdb_st_ino; + llvm::support::ubig32_t gdb_st_mode; + llvm::support::ubig32_t gdb_st_nlink; + llvm::support::ubig32_t gdb_st_uid; + llvm::support::ubig32_t gdb_st_gid; + llvm::support::ubig32_t gdb_st_rdev; + llvm::support::ubig64_t gdb_st_size; + llvm::support::ubig64_t gdb_st_blksize; + llvm::support::ubig64_t gdb_st_blocks; + llvm::support::ubig32_t gdb_st_atime; + llvm::support::ubig32_t gdb_st_mtime; + llvm::support::ubig32_t gdb_st_ctime; +}; +static_assert(sizeof(GDBRemoteFStatData) == 64, + "size of GDBRemoteFStatData is not 64"); + class ProcessGDBRemote; class GDBRemoteCommunication : public Communication { |