diff options
author | Mikhail Zakharov <zmish1993@gmail.com> | 2025-05-01 20:10:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-01 11:10:41 -0700 |
commit | 6aa963f780d63d4c8fa80de97dd79c932bc35f4e (patch) | |
tree | 9213c8b16ea52efd9c93ea59cdfec3e70260d350 /lldb/source/Commands/CommandObjectProcess.cpp | |
parent | 334e05b4b78a5de6efdcb23f208f3453a5b364a0 (diff) | |
download | llvm-6aa963f780d63d4c8fa80de97dd79c932bc35f4e.zip llvm-6aa963f780d63d4c8fa80de97dd79c932bc35f4e.tar.gz llvm-6aa963f780d63d4c8fa80de97dd79c932bc35f4e.tar.bz2 |
[lldb] Do not bump memory modificator ID when "internal" debugger memory is updated (#129092)
This change adds a setting `target.process.track-memory-cache-changes`.
Disabling this setting prevents invalidating and updating values in
`ValueObject::UpdateValueIfNeeded` when only "internal" debugger memory
is updated. Writing to "internal" debugger memory happens when, for
instance, expressions are evaluated by visualizers (pretty printers).
One of the examples when cache invalidation has a particularly heavy
impact is visualizations of some collections: in some collections
getting collection size is an expensive operation (it requires traversal
of the collection).
At the same time evaluating user expression with side effects (visible
to target, not only to debugger) will still bump memory ID because:
- If expression is evaluated via interpreter: it will cause write to
"non-internal" memory
- If expression is JIT-compiled: then to call the function LLDB will
write to "non-internal" stack memory
The downside of disabled `target.process.track-memory-cache-changes`
setting is that convenience variables won't reevaluate synthetic
children automatically.
---------
Co-authored-by: Mikhail Zakharov <mikhail.zakharov@jetbrains.com>
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index ed80c85..d0f5eaf 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1388,6 +1388,9 @@ public: case 'v': m_verbose = true; break; + case 'd': + m_dump = true; + break; default: llvm_unreachable("Unimplemented option"); } @@ -1397,6 +1400,7 @@ public: void OptionParsingStarting(ExecutionContext *execution_context) override { m_verbose = false; + m_dump = false; } llvm::ArrayRef<OptionDefinition> GetDefinitions() override { @@ -1405,6 +1409,7 @@ public: // Instance variables to hold the values for command options. bool m_verbose = false; + bool m_dump = false; }; protected: @@ -1459,6 +1464,14 @@ protected: crash_info_sp->GetDescription(strm); } } + + if (m_options.m_dump) { + StateType state = process->GetState(); + if (state == eStateStopped) { + ProcessModID process_mod_id = process->GetModID(); + process_mod_id.Dump(result.GetOutputStream()); + } + } } private: |