[llvm-branch-commits] [lldb] ad25bdc - Change static buffer to be BSS instead of DATA in HandlePacket_qSpeedTest
Jason Molenda via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jan 22 16:18:22 PST 2021
Author: Jason Molenda
Date: 2021-01-22T16:14:24-08:00
New Revision: ad25bdcb8e4e9459886062d3855a5971af758731
URL: https://github.com/llvm/llvm-project/commit/ad25bdcb8e4e9459886062d3855a5971af758731
DIFF: https://github.com/llvm/llvm-project/commit/ad25bdcb8e4e9459886062d3855a5971af758731.diff
LOG: Change static buffer to be BSS instead of DATA in HandlePacket_qSpeedTest
Having this 4MB buffer with a compile-time initialized string forced it
into the DATA section and it took up 4MB of space in the binary, which
accounts for like 80% of debugserver's footprint on disk. Change it to
BSS and strcpy in the initial value at runtime instead.
<rdar://problem/73503892>
Added:
Modified:
lldb/tools/debugserver/source/RNBRemote.cpp
Removed:
################################################################################
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index fd713f08a3cc..586336a21b6b 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4578,7 +4578,8 @@ rnb_err_t RNBRemote::HandlePacket_qSpeedTest(const char *p) {
__FILE__, __LINE__, p,
"Didn't find response_size value at right offset");
else if (*end == ';') {
- static char g_data[4 * 1024 * 1024 + 16] = "data:";
+ static char g_data[4 * 1024 * 1024 + 16];
+ strcpy(g_data, "data:");
memset(g_data + 5, 'a', response_size);
g_data[response_size + 5] = '\0';
return SendPacket(g_data);
More information about the llvm-branch-commits
mailing list