diff options
author | Jason Molenda <jason@molenda.com> | 2021-01-22 16:11:47 -0800 |
---|---|---|
committer | Jason Molenda <jason@molenda.com> | 2021-01-22 16:14:24 -0800 |
commit | ad25bdcb8e4e9459886062d3855a5971af758731 (patch) | |
tree | a9527fd71880fe527f6c0379bfda5bc5edab4a9b | |
parent | ca904b81e6488b45cbfe846dc86f1406b8e9c03d (diff) | |
download | llvm-ad25bdcb8e4e9459886062d3855a5971af758731.zip llvm-ad25bdcb8e4e9459886062d3855a5971af758731.tar.gz llvm-ad25bdcb8e4e9459886062d3855a5971af758731.tar.bz2 |
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>
-rw-r--r-- | lldb/tools/debugserver/source/RNBRemote.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index fd713f0..586336a 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); |