Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | ||
---|---|---|
774 | 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... |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | ||
---|---|---|
774 | 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. |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | ||
---|---|---|
789 | Just make sure the fields stay initialized (to zero, I guess) |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | ||
---|---|---|
762 | I am building on a macOS and I seeing the following diagnostic for this line: warning: comparison of integers of different signs: 'int' and 'std::numeric_limits<unsigned int>::type' (aka 'unsigned int') [-Wsign-compare] dest = src <= std::numeric_limits<typename T::value_type>::max() ? src ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and it is triggered by: fill_clamp(data.gdb_st_dev, file_stats.st_dev, 0); In this case it will do the right thing but allowing mixed types is problematic, usually I see clamp done with homogeneous types. |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | ||
---|---|---|
762 | Could you suggest how to fix it? Some platforms have different signedness than the GDB struct type. |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | ||
---|---|---|
762 | Since we don't have C++20 I think you would have to roll your own cmp_less see the possible implementation on cppreference. For reference see Safe integral comparisons proposal. I looked and I don't see something similar in llvm anywhere but I could be missing it. |
static void