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);
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);
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits