[Lldb-commits] [PATCH] D111052: [lldb] [gdb-remote] Correct st_dev values in vFile:fstat packet
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 4 06:06:16 PDT 2021
mgorny created this revision.
mgorny added reviewers: teemperor, labath, krytarowski, emaste.
mgorny requested review of this revision.
Correct the st_dev values used by vFile:fstat packet to conform to
the GDB protocol. Thanks to Raphael Isemann for noticing.
https://reviews.llvm.org/D111052
Files:
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
Index: lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
@@ -266,7 +266,7 @@
.encode("iso-8859-1")))
sys_stat = os.fstat(temp_file.fileno())
- self.assertEqual(gdb_stat.st_dev, uint32_or_zero(sys_stat.st_dev))
+ self.assertEqual(gdb_stat.st_dev, 0)
self.assertEqual(gdb_stat.st_ino, uint32_or_zero(sys_stat.st_ino))
self.assertEqual(gdb_stat.st_mode, uint32_trunc(sys_stat.st_mode))
self.assertEqual(gdb_stat.st_nlink, uint32_or_max(sys_stat.st_nlink))
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -790,7 +790,9 @@
}
GDBRemoteFStatData data;
- fill_clamp(data.gdb_st_dev, file_stats.st_dev, 0);
+ // st_dev is used specially here: 0 means a file, 1 a console
+ // (i.e. a fd used as program's stdin/stdout/stderr)
+ data.gdb_st_dev = 0;
fill_clamp(data.gdb_st_ino, file_stats.st_ino, 0);
data.gdb_st_mode = file_stats.st_mode;
fill_clamp(data.gdb_st_nlink, file_stats.st_nlink, UINT32_MAX);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111052.376877.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211004/bb011be4/attachment.bin>
More information about the lldb-commits
mailing list