forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit 846fa24
committed
dpu: llvm: lldb: DpuContext: fix initialization ordering
A DpuContext, wrapper of backends's `struct dpu_context_t` is constructed for
every LLDB Dpu instance. These instances cover a full rank.
Currently, a DpuContext instance is partialialy initialize at the first StopThreads
call (i.e. when LLDB stop threads for investigation) on which Dpu is
currently allocated.
When LLDB resume threads with ResumeThreads call, it tries to resume threads from
all LLDB::Dpu instance. Though, this does not correspond to the number of requested Dpus.
Hence, LLDB manipulates unitialized object.
This commit fixes those report from `valgrind`:
```
==17528== Conditional jump or move depends on uninitialised value(s)
==17528== at 0x182A1E: lldb_private::dpu::DpuContext::ContextReadyForResumeOrStep() (DpuContext.cpp:153)
==17528== by 0x180C68: lldb_private::dpu::Dpu::ResumeThreads(llvm::SmallVector<unsigned int, 8u>*, bool) (Dpu.cpp:295)
==17528== by 0x18069C: lldb_private::dpu::DpuRank::ResumeDpus() (DpuRank.cpp:125)
==17528== by 0x17DDEB: lldb_private::process_dpu::ProcessDpu::Detach() (ProcessDpu.cpp:460)
==17528== by 0x17D339: lldb_private::process_dpu::ProcessDpu::Kill() (ProcessDpu.cpp:512)
==17528== by 0x1A8E70: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1A904D: std::_Function_handler<lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult (StringExtractorGDBRemote&, lldb_private::Status&, bool&, bool&), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers()::{lambda(StringExtractorGDBRemote, lldb_private::Status&, bool&, bool&)#1}>::_M_invoke(std::_Any_data const&, StringExtractorGDBRemote&, lldb_priv
ate::Status&, bool&, bool&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x19839D: lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::GetPacketAndSendResponse(lldb_private::Timeout<std::ratio<1l, 1000000l> >, lldb_private::Status&, bool&, bool&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1A8A74: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::DataAvailableCallback() (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1597DE: lldb_private::MainLoop::ProcessReadObject(int) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1598A3: lldb_private::MainLoop::RunImpl::ProcessEvents() (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x159CCF: lldb_private::MainLoop::Run() (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528==
==17528== Conditional jump or move depends on uninitialised value(s)
==17528== at 0x180C6F: lldb_private::dpu::Dpu::ResumeThreads(llvm::SmallVector<unsigned int, 8u>*, bool) (Dpu.cpp:295)
==17528== by 0x18069C: lldb_private::dpu::DpuRank::ResumeDpus() (DpuRank.cpp:125)
==17528== by 0x17DDEB: lldb_private::process_dpu::ProcessDpu::Detach() (ProcessDpu.cpp:460)
==17528== by 0x17D339: lldb_private::process_dpu::ProcessDpu::Kill() (ProcessDpu.cpp:512)
==17528== by 0x1A8E70: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1A904D: std::_Function_handler<lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult (StringExtractorGDBRemote&, lldb_private::Status&, bool&, bool&), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers()::{lambda(StringExtractorGDBRemote, lldb_private::Status&, bool&, bool&)#1}>::_M_invoke(std::_Any_data const&, StringExtractorGDBRemote&, lldb_priv
ate::Status&, bool&, bool&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x19839D: lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::GetPacketAndSendResponse(lldb_private::Timeout<std::ratio<1l, 1000000l> >, lldb_private::Status&, bool&, bool&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1A8A74: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::DataAvailableCallback() (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1597DE: lldb_private::MainLoop::ProcessReadObject(int) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1598A3: lldb_private::MainLoop::RunImpl::ProcessEvents() (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x159CCF: lldb_private::MainLoop::Run() (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x14C220: main_gdbserver(int, char**) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528==
==17528== Conditional jump or move depends on uninitialised value(s)
==17528== at 0x489E135: ci_debug_teardown_dpu (ufi_debug.c:443)
==17528== by 0x488B339: dpu_finalize_fault_process_for_dpu (dpu_debug.c:120)
==17528== by 0x182C1C: lldb_private::dpu::DpuContext::ResumeThreads(llvm::SmallVector<unsigned int, 8u>*) (DpuContext.cpp:120)
==17528== by 0x180C9B: lldb_private::dpu::Dpu::ResumeThreads(llvm::SmallVector<unsigned int, 8u>*, bool) (Dpu.cpp:308)
==17528== by 0x18069C: lldb_private::dpu::DpuRank::ResumeDpus() (DpuRank.cpp:125)
==17528== by 0x17DDEB: lldb_private::process_dpu::ProcessDpu::Detach() (ProcessDpu.cpp:460)
==17528== by 0x17D339: lldb_private::process_dpu::ProcessDpu::Kill() (ProcessDpu.cpp:512)
==17528== by 0x1A8E70: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1A904D: std::_Function_handler<lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult (StringExtractorGDBRemote&, lldb_private::Status&, bool&, bool&), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers()::{lambda(StringExtractorGDBRemote, lldb_private::Status&, bool&, bool&)#1}>::_M_invoke(std::_Any_data const&, StringExtractorGDBRemote&, lldb_priv
ate::Status&, bool&, bool&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x19839D: lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::GetPacketAndSendResponse(lldb_private::Timeout<std::ratio<1l, 1000000l> >, lldb_private::Status&, bool&, bool&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1A8A74: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::DataAvailableCallback() (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1597DE: lldb_private::MainLoop::ProcessReadObject(int) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528==
==17528== Conditional jump or move depends on uninitialised value(s)
==17528== at 0x489E140: ci_debug_teardown_dpu (ufi_debug.c:443)
==17528== by 0x488B339: dpu_finalize_fault_process_for_dpu (dpu_debug.c:120)
==17528== by 0x182C1C: lldb_private::dpu::DpuContext::ResumeThreads(llvm::SmallVector<unsigned int, 8u>*) (DpuContext.cpp:120)
==17528== by 0x180C9B: lldb_private::dpu::Dpu::ResumeThreads(llvm::SmallVector<unsigned int, 8u>*, bool) (Dpu.cpp:308)
==17528== by 0x18069C: lldb_private::dpu::DpuRank::ResumeDpus() (DpuRank.cpp:125)
==17528== by 0x17DDEB: lldb_private::process_dpu::ProcessDpu::Detach() (ProcessDpu.cpp:460)
==17528== by 0x17D339: lldb_private::process_dpu::ProcessDpu::Kill() (ProcessDpu.cpp:512)
==17528== by 0x1A8E70: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1A904D: std::_Function_handler<lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult (StringExtractorGDBRemote&, lldb_private::Status&, bool&, bool&), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers()::{lambda(StringExtractorGDBRemote, lldb_private::Status&, bool&, bool&)#1}>::_M_invoke(std::_Any_data const&, StringExtractorGDBRemote&, lldb_priv
ate::Status&, bool&, bool&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x19839D: lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::GetPacketAndSendResponse(lldb_private::Timeout<std::ratio<1l, 1000000l> >, lldb_private::Status&, bool&, bool&) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1A8A74: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::DataAvailableCallback() (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528== by 0x1597DE: lldb_private::MainLoop::ProcessReadObject(int) (in /scratch/wwolff/dpu_tools_rework_testsuite/bin/lldb-server-dpu)
==17528==
```1 parent 12c0e15 commit 846fa24Copy full SHA for 846fa24
File tree
Expand file treeCollapse file tree
1 file changed
+4
-4
lines changedFilter options
- lldb/source/Plugins/Process/Dpu
Expand file treeCollapse file tree
1 file changed
+4
-4
lines changedCollapse file: lldb/source/Plugins/Process/Dpu/DpuContext.cpp
lldb/source/Plugins/Process/Dpu/DpuContext.cpp
Copy file name to clipboardExpand all lines: lldb/source/Plugins/Process/Dpu/DpuContext.cpp+4-4Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
53 | 57 |
| |
54 | 58 |
| |
55 | 59 |
| |
| |||
82 | 86 |
| |
83 | 87 |
| |
84 | 88 |
| |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 | 89 |
| |
90 | 90 |
| |
91 | 91 |
| |
|
0 commit comments