[Lldb-commits] [lldb] [LLDB][Minidumps] Read x64 registers as 64b and handle truncation in the file builder (PR #106473)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 28 16:59:38 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r a7ba73bf614f6d147bd1cdaddee156bd85e31703...88a1a5d2b8698a5474bff0756012369401f7f433 lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- TestProcessSaveCoreMinidump.py 2024-08-28 23:55:13.000000 +0000
+++ TestProcessSaveCoreMinidump.py 2024-08-28 23:59:10.684575 +0000
@@ -66,11 +66,16 @@
# Verify the registers are the same
self.assertTrue(thread_id, stacks_to_registers_map)
register_val_list = stacks_to_registers_map[thread_id]
frame_register_list = frame.GetRegisters()
for x in register_val_list:
- self.assertEqual(x.GetValueAsUnsigned(), frame_register_list.GetFirstValueByName(x.GetName()).GetValueAsUnsigned())
+ self.assertEqual(
+ x.GetValueAsUnsigned(),
+ frame_register_list.GetFirstValueByName(
+ x.GetName()
+ ).GetValueAsUnsigned(),
+ )
self.dbg.DeleteTarget(target)
@skipUnlessArch("x86_64")
@skipUnlessPlatform(["linux"])
@@ -105,11 +110,13 @@
for thread_idx in range(process.GetNumThreads()):
thread = process.GetThreadAtIndex(thread_idx)
thread_id = thread.GetThreadID()
expected_threads.append(thread_id)
stacks_to_sp_map[thread_id] = thread.GetFrameAtIndex(0).GetSP()
- stakcs_to_registers_map[thread_id] = thread.GetFrameAtIndex(0).GetRegisters()
+ stakcs_to_registers_map[thread_id] = thread.GetFrameAtIndex(
+ 0
+ ).GetRegisters()
# save core and, kill process and verify corefile existence
base_command = "process save-core --plugin-name=minidump "
self.runCmd(base_command + " --style=stack '%s'" % (core_stack))
self.assertTrue(os.path.isfile(core_stack))
@@ -117,33 +124,33 @@
core_stack,
expected_pid,
expected_modules,
expected_threads,
stacks_to_sp_map,
- stakcs_to_registers_map
+ stakcs_to_registers_map,
)
self.runCmd(base_command + " --style=modified-memory '%s'" % (core_dirty))
self.assertTrue(os.path.isfile(core_dirty))
self.verify_core_file(
core_dirty,
expected_pid,
expected_modules,
expected_threads,
stacks_to_sp_map,
- stakcs_to_registers_map
+ stakcs_to_registers_map,
)
self.runCmd(base_command + " --style=full '%s'" % (core_full))
self.assertTrue(os.path.isfile(core_full))
self.verify_core_file(
core_full,
expected_pid,
expected_modules,
expected_threads,
stacks_to_sp_map,
- stakcs_to_registers_map
+ stakcs_to_registers_map,
)
options = lldb.SBSaveCoreOptions()
core_sb_stack_spec = lldb.SBFileSpec(core_sb_stack)
options.SetOutputFile(core_sb_stack_spec)
@@ -157,11 +164,11 @@
core_sb_stack,
expected_pid,
expected_modules,
expected_threads,
stacks_to_sp_map,
- stakcs_to_registers_map
+ stakcs_to_registers_map,
)
options = lldb.SBSaveCoreOptions()
core_sb_dirty_spec = lldb.SBFileSpec(core_sb_dirty)
options.SetOutputFile(core_sb_dirty_spec)
@@ -174,11 +181,11 @@
core_sb_dirty,
expected_pid,
expected_modules,
expected_threads,
stacks_to_sp_map,
- stakcs_to_registers_map
+ stakcs_to_registers_map,
)
# Minidump can now save full core files, but they will be huge and
# they might cause this test to timeout.
options = lldb.SBSaveCoreOptions()
@@ -193,11 +200,11 @@
core_sb_full,
expected_pid,
expected_modules,
expected_threads,
stacks_to_sp_map,
- stakcs_to_registers_map
+ stakcs_to_registers_map,
)
self.assertSuccess(process.Kill())
finally:
# Clean up the mini dump file.
@@ -296,12 +303,13 @@
for thread_idx in range(process.GetNumThreads()):
thread = process.GetThreadAtIndex(thread_idx)
thread_id = thread.GetThreadID()
expected_threads.append(thread_id)
stacks_to_sp_map[thread_id] = thread.GetFrameAtIndex(0).GetSP()
- stacks_to_registers_map[thread_id] = thread.GetFrameAtIndex(0).GetRegisters()
-
+ stacks_to_registers_map[thread_id] = thread.GetFrameAtIndex(
+ 0
+ ).GetRegisters()
# This is almost identical to the single thread test case because
# minidump defaults to stacks only, so we want to see if the
# default options work as expected.
options = lldb.SBSaveCoreOptions()
@@ -315,11 +323,11 @@
default_value_file,
expected_pid,
expected_modules,
expected_threads,
stacks_to_sp_map,
- stacks_to_registers_map
+ stacks_to_registers_map,
)
finally:
self.assertTrue(self.dbg.DeleteTarget(target))
if os.path.isfile(default_value_file):
``````````
</details>
https://github.com/llvm/llvm-project/pull/106473
More information about the lldb-commits
mailing list