diff options
author | Étienne Barrié <[email protected]> | 2025-04-10 15:24:52 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-04-15 11:50:48 +0900 |
commit | 6e184ebb5aa0461936a6db408a7fa48541a0e80d (patch) | |
tree | 728d8373b0be51610a88a196de9d8f83eada8bb6 | |
parent | 0606046c1a3816eabb26b5de18942c02710eb28e (diff) |
Fix LLDB heap_page command
Move _append_command_output and _append_expression to LLDBInterface, and
use it from HeapPageCommand after setting result.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13096
-rw-r--r-- | misc/lldb_rb/commands/heap_page_command.py | 5 | ||||
-rw-r--r-- | misc/lldb_rb/lldb_interface.py | 11 | ||||
-rw-r--r-- | misc/lldb_rb/utils.py | 11 |
3 files changed, 14 insertions, 13 deletions
diff --git a/misc/lldb_rb/commands/heap_page_command.py b/misc/lldb_rb/commands/heap_page_command.py index b56a3eae4e..2eed3c3bee 100644 --- a/misc/lldb_rb/commands/heap_page_command.py +++ b/misc/lldb_rb/commands/heap_page_command.py @@ -8,14 +8,15 @@ class HeapPageCommand(RbBaseCommand): help_string = "prints out 'struct heap_page' for a VALUE pointer in the page" def call(self, debugger, command, exe_ctx, result): + self.result = result self.t_heap_page_body = self.target.FindFirstType("struct heap_page_body") self.t_heap_page_ptr = self.target.FindFirstType("struct heap_page").GetPointerType() page = self._get_page(self.frame.EvaluateExpression(command)) page.Cast(self.t_heap_page_ptr) - self._append_expression(debugger, "(struct heap_page *) %0#x" % page.GetValueAsUnsigned(), result) - self._append_expression(debugger, "*(struct heap_page *) %0#x" % page.GetValueAsUnsigned(), result) + self._append_expression("(struct heap_page *) %0#x" % page.GetValueAsUnsigned()) + self._append_expression("*(struct heap_page *) %0#x" % page.GetValueAsUnsigned()) def _get_page(self, val): addr = val.GetValueAsUnsigned() diff --git a/misc/lldb_rb/lldb_interface.py b/misc/lldb_rb/lldb_interface.py index 785a54b3e3..25930b2e16 100644 --- a/misc/lldb_rb/lldb_interface.py +++ b/misc/lldb_rb/lldb_interface.py @@ -5,3 +5,14 @@ class LLDBInterface: self.process = self.target.GetProcess() self.thread = self.process.GetSelectedThread() self.frame = self.thread.GetSelectedFrame() + + def _append_command_output(self, command): + output1 = self.result.GetOutput() + self.debugger.GetCommandInterpreter().HandleCommand(command, self.result) + output2 = self.result.GetOutput() + self.result.Clear() + self.result.write(output1) + self.result.write(output2) + + def _append_expression(self, expression): + self._append_command_output("expression " + expression) diff --git a/misc/lldb_rb/utils.py b/misc/lldb_rb/utils.py index a6bbd385cd..f4775bc4f9 100644 --- a/misc/lldb_rb/utils.py +++ b/misc/lldb_rb/utils.py @@ -8,17 +8,6 @@ class RbInspector(LLDBInterface): self.result = result self.ruby_globals = ruby_globals - def _append_command_output(self, command): - output1 = self.result.GetOutput() - self.debugger.GetCommandInterpreter().HandleCommand(command, self.result) - output2 = self.result.GetOutput() - self.result.Clear() - self.result.write(output1) - self.result.write(output2) - - def _append_expression(self, expression): - self._append_command_output("expression " + expression) - def string2cstr(self, rstring): """Returns the pointer to the C-string in the given String object""" if rstring.TypeIsPointerType(): |