[Lldb-commits] [lldb] b889ef4 - [lldb/Core] Change large function threshold variable into a setting.
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 25 13:35:28 PST 2021
Author: Med Ismail Bennani
Date: 2021-02-25T22:35:04+01:00
New Revision: b889ef4214bc6dc8880fdd4badc0dcd9a3197753
URL: https://github.com/llvm/llvm-project/commit/b889ef4214bc6dc8880fdd4badc0dcd9a3197753
DIFF: https://github.com/llvm/llvm-project/commit/b889ef4214bc6dc8880fdd4badc0dcd9a3197753.diff
LOG: [lldb/Core] Change large function threshold variable into a setting.
This patch replaces the static large function threshold variable with a
global debugger setting (`stop-disassembly-max-size`).
The default threshold is now set to 32KB (instead of 8KB) and can be modified.
rdar://74726362
Differential Revision: https://reviews.llvm.org/D97486
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Added:
Modified:
lldb/include/lldb/Core/Debugger.h
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/source/Core/CoreProperties.td
lldb/source/Core/Debugger.cpp
lldb/test/Shell/Commands/command-disassemble-process.yaml
lldb/test/Shell/Commands/command-disassemble.s
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index 68daae1a3710..02ff683a3b62 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -246,6 +246,8 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
const FormatEntity::Entry *GetFrameFormatUnique() const;
+ uint32_t GetStopDisassemblyMaxSize() const;
+
const FormatEntity::Entry *GetThreadFormat() const;
const FormatEntity::Entry *GetThreadStopFormat() const;
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index cf4d8ed04f81..8d2b13a5a4c0 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -23,7 +23,6 @@
static constexpr unsigned default_disasm_byte_size = 32;
static constexpr unsigned default_disasm_num_ins = 4;
-static constexpr unsigned large_function_threshold = 8000;
using namespace lldb;
using namespace lldb_private;
@@ -223,7 +222,7 @@ CommandObjectDisassemble::~CommandObjectDisassemble() = default;
llvm::Error CommandObjectDisassemble::CheckRangeSize(const AddressRange &range,
llvm::StringRef what) {
if (m_options.num_instructions > 0 || m_options.force ||
- range.GetByteSize() < large_function_threshold)
+ range.GetByteSize() < GetDebugger().GetStopDisassemblyMaxSize())
return llvm::Error::success();
StreamString msg;
msg << "Not disassembling " << what << " because it is very large ";
diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td
index 96f67801553b..ccd6f7b97a5f 100644
--- a/lldb/source/Core/CoreProperties.td
+++ b/lldb/source/Core/CoreProperties.td
@@ -51,6 +51,10 @@ let Definition = "debugger" in {
DefaultEnumValue<"Debugger::eStopDisassemblyTypeNoDebugInfo">,
EnumValues<"OptionEnumValues(g_show_disassembly_enum_values)">,
Desc<"Control when to display disassembly when displaying a stopped context.">;
+ def StopDisassemblyMaxSize: Property<"stop-disassembly-max-size", "UInt64">,
+ Global,
+ DefaultUnsignedValue<32000>,
+ Desc<"The size limit to use when disassembling large functions (default: 32KB).">;
def StopLineCountAfter: Property<"stop-line-count-after", "SInt64">,
Global,
DefaultUnsignedValue<3>,
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 1294b600c611..a9a5c7445976 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -258,6 +258,12 @@ const FormatEntity::Entry *Debugger::GetFrameFormatUnique() const {
return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);
}
+uint32_t Debugger::GetStopDisassemblyMaxSize() const {
+ const uint32_t idx = ePropertyStopDisassemblyMaxSize;
+ return m_collection_sp->GetPropertyAtIndexAsUInt64(
+ nullptr, idx, g_debugger_properties[idx].default_uint_value);
+}
+
bool Debugger::GetNotifyVoid() const {
const uint32_t idx = ePropertyNotiftVoid;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
diff --git a/lldb/test/Shell/Commands/command-disassemble-process.yaml b/lldb/test/Shell/Commands/command-disassemble-process.yaml
index e87c4761981a..f08792f867c0 100644
--- a/lldb/test/Shell/Commands/command-disassemble-process.yaml
+++ b/lldb/test/Shell/Commands/command-disassemble-process.yaml
@@ -10,6 +10,7 @@
# RUN: | FileCheck %s
# RUN: %lldb -c %t %T/command-disassemble-process.big.exe \
+# RUN: -o "settings set stop-disassembly-max-size 8000" \
# RUN: -o disassemble -o exit 2>&1 | FileCheck %s --check-prefix=BIG
# CHECK: (lldb) disassemble
diff --git a/lldb/test/Shell/Commands/command-disassemble.s b/lldb/test/Shell/Commands/command-disassemble.s
index e59edd05dbaa..1feff0b878c8 100644
--- a/lldb/test/Shell/Commands/command-disassemble.s
+++ b/lldb/test/Shell/Commands/command-disassemble.s
@@ -2,6 +2,7 @@
# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o %t
# RUN: %lldb %t -o "settings set interpreter.stop-command-source-on-error false" \
+# RUN: -o "settings set stop-disassembly-max-size 8000" \
# RUN: -s %S/Inputs/command-disassemble.lldbinit -o exit 2>&1 | FileCheck %s
# CHECK: (lldb) disassemble
More information about the lldb-commits
mailing list