<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54520>54520</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
lldb-server process crashes when debugging on pcc64le
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lldb,
crash
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tbaederr
</td>
</tr>
</table>
<pre>
Backtrace:
```
#0 0x00007fffed4d6efc in __pthread_kill_implementation () from /lib64/libc.so.6
#1 0x00007fffed47633c in raise () from /lib64/libc.so.6
#2 0x00007fffed45076c in abort () from /lib64/libc.so.6
#3 0x000000001052b628 in std::__replacement_assert (__file=0x1104bc40 "/usr/include/c++/11/array", __line=188,
__function=0x1104bac8 "std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](std::array<_Tp, _Nm>::size_type) [with _Tp = lldb_private::process_linux::NativeRegisterContextLinux_ppc64le::DREG; long unsigned int"..., __condition=0x1104bab0 "__n < this->size()") at /usr/include/c++/11/ppc64le-redhat-linux/bits/c++config.h:514
#4 0x00000000105dd13c in std::array<lldb_private::process_linux::NativeRegisterContextLinux_ppc64le::DREG, 4ul>::operator[] (this=0x115c7f78, __n=4) at /usr/include/c++/11/array:188
#5 0x00000000100a6f18 in lldb_private::process_linux::NativeRegisterContextLinux_ppc64le::GetWatchpointSize (this=0x115c76f0, wp_index=4)
at ../source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp:648
#6 0x00000000100a7210 in lldb_private::process_linux::NativeRegisterContextLinux_ppc64le::GetWatchpointHitIndex (this=0x115c76f0, wp_index=@0x7fffffffd060: 4, trap_addr=140737353910136)
at ../source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp:673
#7 0x0000000010093f00 in lldb_private::process_linux::NativeProcessLinux::MonitorSIGTRAP (this=0x115c70c0, info=..., thread=...) at ../source/Plugins/Process/Linux/NativeProcessLinux.cpp:690
#8 0x0000000010093098 in lldb_private::process_linux::NativeProcessLinux::MonitorCallback (this=0x115c70c0, pid=539214, exited=false, status=...) at ../source/Plugins/Process/Linux/NativeProcessLinux.cpp:488
#9 0x000000001009bbfc in lldb_private::process_linux::NativeProcessLinux::SigchldHandler (this=0x115c70c0) at ../source/Plugins/Process/Linux/NativeProcessLinux.cpp:1976
#10 0x000000001058b2a0 in lldb_private::process_linux::NativeProcessLinux::NativeProcessLinux(int, int, lldb_private::NativeProcessProtocol::NativeDelegate&, lldb_private::ArchSpec const&, lldb_private::MainLoop&, llvm::ArrayRef<int>)::{lambda(lldb_private::MainLoopBase&)#1}::operator()(lldb_private::MainLoopBase&) const () at ../source/Plugins/Process/Linux/NativeProcessLinux.cpp:323
#11 0x00000000105af330 in std::__invoke_impl<void, lldb_private::process_linux::NativeProcessLinux::NativeProcessLinux(pid_t, int, lldb_private::NativeProcessProtocol::NativeDelegate&, const lldb_private::ArchSpec&, lldb_private::MainLoop&, llvm::ArrayRef<int>)::<lambda(lldb_private::MainLoopBase&)>&, lldb_private::MainLoopBase&>(std::__invoke_other, struct {...} &, lldb_private::MainLoopBase &) (__f=...)
at /usr/include/c++/11/bits/invoke.h:61
#12 0x00000000105a2bec in std::__invoke_r<void, lldb_private::process_linux::NativeProcessLinux::NativeProcessLinux(pid_t, int, lldb_private::NativeProcessProtocol::NativeDelegate&, const lldb_private::ArchSpec&, lldb_private::MainLoop&, llvm::ArrayRef<int>)::<lambda(lldb_private::MainLoopBase&)>&, lldb_private::MainLoopBase&>(struct {...} &, lldb_private::MainLoopBase &) (__fn=...)
at /usr/include/c++/11/bits/invoke.h:154
#13 0x0000000010598afc in std::_Function_handler<void(lldb_private::MainLoopBase&), lldb_private::process_linux::NativeProcessLinux::NativeProcessLinux(pid_t, int, lldb_private::NativeProcessProtocol::NativeDelegate&, const lldb_private::ArchSpec&, lldb_private::MainLoop&, llvm::ArrayRef<int>)::<lambda(lldb_private::MainLoopBase&)> >::_M_invoke(const std::_Any_data &, lldb_private::MainLoopBase &) (__functor=...,
__args#0=...) at /usr/include/c++/11/bits/std_function.h:290
#14 0x0000000010522760 in std::function<void (lldb_private::MainLoopBase&)>::operator()(lldb_private::MainLoopBase&) const (this=0x7fffffffd678, __args#0=...) at /usr/include/c++/11/bits/std_function.h:590
#15 0x000000001005aab8 in lldb_private::MainLoop::ProcessSignal (this=0x7fffffffd9e0, signo=17) at ../source/Host/common/MainLoop.cpp:416
#16 0x0000000010059fd8 in lldb_private::MainLoop::RunImpl::ProcessEvents (this=0x7fffffffd808) at ../source/Host/common/MainLoop.cpp:253
#17 0x000000001005a868 in lldb_private::MainLoop::Run (this=0x7fffffffd9e0) at ../source/Host/common/MainLoop.cpp:403
#18 0x00000000104e9fa0 in main_gdbserver (argc=7, argv=0x7fffffffeb58) at ../tools/lldb-server/lldb-gdbserver.cpp:519
#19 0x000000001050092c in main (argc=7, argv=0x7fffffffeb58) at ../tools/lldb-server/lldb-server.cpp:65
```
`NativeRegisterContextLinux_ppc64le::m_hwp_regs` is a `std::array` of size 4, but the `m_max_hwp_supported` variable is initialized to 16. Is this intentional?
I understand that `m_max_hwp_supported` can later be assigned a different value via `ReadHardwareDebugInfo()`, but that has either not happened or yields 16 anyway.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWdtu2zgQ_Rr7hYhBUTfrwQ-51G2AtCjSAvsoUCJlcUOLAkk5zn79DiX5ptgbp_HuvtQILEsih2fOHHKGTKbYy-yG5k9W05yP_OsRvhvhzXeE-7_ulvgYIbzG8ImLouAsYBEvciQqlKa1LTWnLH0SUqZiWUu-5JWlVqgKjch0RBJUaLWE33MpsijorvnEqEm0te8N7MeR77f2NRWGn2-HDOyEOI5aOzRT2p5vx9_YcR8PhySLyNTZMZY5svzrNNW8lsCd8zalxvDOfpoWQgKhd3jteTjI8gDDYwKjNEbDt6hy2TAOv_IRuWn_5p4HX1Rr-tK2vAVWpaicEW8KgG87WAg-YL2pcsftbgSaT90IW2Sd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