Skip to content

Commit 2df42fe

Browse files
authored
[lldb] [NFC] Remove min pkt size for compression setting (#81075)
debugserver will not compress small packets; the overhead of the compression header makes this useful for larger packets. I default to 384 bytes in debugserver, and added an option for lldb to request a different cutoff. This option has never been used in lldb in the past nine years, so I don't think there's any point to keeping it around.
1 parent ece66db commit 2df42fe

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

lldb/docs/lldb-gdb-remote.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,16 +1998,12 @@ for this region.
19981998
// If the debug stub can support compression, it indictes this in the reply of the
19991999
// "qSupported" packet. e.g.
20002000
// LLDB SENDS: qSupported:xmlRegisters=i386,arm,mips
2001-
// STUB REPLIES: qXfer:features:read+;SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;DefaultCompressionMinSize=384
2001+
// STUB REPLIES: qXfer:features:read+;SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;
20022002
//
20032003
// If lldb knows how to use any of these compression algorithms, it can ask that this
2004-
// compression mode be enabled. It may optionally change the minimum packet size
2005-
// where compression is used. Typically small packets do not benefit from compression,
2006-
// as well as compression headers -- compression is most beneficial with larger packets.
2004+
// compression mode be enabled.
20072005
//
20082006
// QEnableCompression:type:zlib-deflate;
2009-
// or
2010-
// QEnableCompression:type:zlib-deflate;minsize:512;
20112007
//
20122008
// The debug stub should reply with an uncompressed "OK" packet to indicate that the
20132009
// request was accepted. All further packets the stub sends will use this compression.

lldb/tools/debugserver/source/RNBRemote.cpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,8 +3575,6 @@ rnb_err_t RNBRemote::HandlePacket_qSupported(const char *p) {
35753575

35763576
if (enable_compression) {
35773577
reply << "SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;";
3578-
reply << "DefaultCompressionMinSize=" << std::dec << m_compression_minsize
3579-
<< ";";
35803578
}
35813579

35823580
#if (defined(__arm64__) || defined(__aarch64__))
@@ -4482,46 +4480,25 @@ rnb_err_t RNBRemote::HandlePacket_SetEnableAsyncProfiling(const char *p) {
44824480
return SendPacket("OK");
44834481
}
44844482

4485-
// QEnableCompression:type:<COMPRESSION-TYPE>;minsize:<MINIMUM PACKET SIZE TO
4486-
// COMPRESS>;
4483+
// QEnableCompression:type:<COMPRESSION-TYPE>;
44874484
//
44884485
// type: must be a type previously reported by the qXfer:features:
44894486
// SupportedCompressions list
4490-
//
4491-
// minsize: is optional; by default the qXfer:features:
4492-
// DefaultCompressionMinSize value is used
4493-
// debugserver may have a better idea of what a good minimum packet size to
4494-
// compress is than lldb.
44954487

44964488
rnb_err_t RNBRemote::HandlePacket_QEnableCompression(const char *p) {
44974489
p += sizeof("QEnableCompression:") - 1;
44984490

4499-
size_t new_compression_minsize = m_compression_minsize;
4500-
const char *new_compression_minsize_str = strstr(p, "minsize:");
4501-
if (new_compression_minsize_str) {
4502-
new_compression_minsize_str += strlen("minsize:");
4503-
errno = 0;
4504-
new_compression_minsize = strtoul(new_compression_minsize_str, NULL, 10);
4505-
if (errno != 0 || new_compression_minsize == ULONG_MAX) {
4506-
new_compression_minsize = m_compression_minsize;
4507-
}
4508-
}
4509-
45104491
if (strstr(p, "type:zlib-deflate;") != nullptr) {
45114492
EnableCompressionNextSendPacket(compression_types::zlib_deflate);
4512-
m_compression_minsize = new_compression_minsize;
45134493
return SendPacket("OK");
45144494
} else if (strstr(p, "type:lz4;") != nullptr) {
45154495
EnableCompressionNextSendPacket(compression_types::lz4);
4516-
m_compression_minsize = new_compression_minsize;
45174496
return SendPacket("OK");
45184497
} else if (strstr(p, "type:lzma;") != nullptr) {
45194498
EnableCompressionNextSendPacket(compression_types::lzma);
4520-
m_compression_minsize = new_compression_minsize;
45214499
return SendPacket("OK");
45224500
} else if (strstr(p, "type:lzfse;") != nullptr) {
45234501
EnableCompressionNextSendPacket(compression_types::lzfse);
4524-
m_compression_minsize = new_compression_minsize;
45254502
return SendPacket("OK");
45264503
}
45274504

0 commit comments

Comments
 (0)