[Lldb-commits] [PATCH] D107840: [lldb] [gdb-server] Implement the vFile:fstat packet

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 9 10:43:42 PDT 2021


mgorny added inline comments.


================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:776
+
+  std::array<char, 64> data;
+  DataEncoder encoder{data.data(), data.size(), lldb::eByteOrderBig,
----------------
labath wrote:
> consider:
> ```
> struct GdbStat {
>   llvm::support::ubig32_t st_dev;
>   llvm::support::ubig32_t st_ino;
>   ...
> };
> 
> ...
> 
> translate(gdb_stats.st_dev, file_stats.st_dev, 0); // I'm not sure that this clamping is really necessary.
> ...
> ```
> 
> Seems like it could be nicer, particularly as the vFile_Stat function will need to do the same thing...
What's this `translate()` thing? I don't see anything matching in LLVM or LLDB. Or are you saying I should define a helper function?

As for clamping, I think it's better if we send 0 (a "clearly invalid value") than e.g. truncated `st_dev` that would be simply wrong.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107840/new/

https://reviews.llvm.org/D107840



More information about the lldb-commits mailing list