ngscopeclient / scopehal-apps

ngscopeclient and other client applications for libscopehal.
https://www.ngscopeclient.org/
BSD 3-Clause "New" or "Revised" License
534 stars 83 forks source link

Demo scope crash adding triggers #693

Closed DanielO closed 4 months ago

DanielO commented 4 months ago

Adding a trigger to the demo scope crashes with a NULL pointer deref, 100% reproducible for me with:

Process 80344 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
    frame #0: 0x0000000101b5eb54 libscopehal.dylib`FlowGraphNode::GetInputCount() [inlined] std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::size[abi:ue170006](this=0x0000000000000008 size=0) const at vector:604:46 [opt]
   601
   602      _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
   603      size_type size() const _NOEXCEPT
-> 604          {return static_cast<size_type>(this->__end_ - this->__begin_);}
   605      _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
   606      size_type capacity() const _NOEXCEPT
   607          {return static_cast<size_type>(__end_cap() - this->__begin_);}
Target 0: (ngscopeclient) stopped.
warning: libscopehal.dylib was compiled with optimization - stepping may behave oddly; variables may not be available.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
  * frame #0: 0x0000000101b5eb54 libscopehal.dylib`FlowGraphNode::GetInputCount() [inlined] std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::size[abi:ue170006](this=0x0000000000000008 size=0) const at vector:604:46 [opt]
    frame #1: 0x0000000101b5eb54 libscopehal.dylib`FlowGraphNode::GetInputCount(this=0x0000000000000000) at FlowGraphNode.cpp:128:23 [opt]
    frame #2: 0x000000010045e644 ngscopeclient`TriggerPropertiesDialog::DoRender(this=0x0000600001824358) at TriggerPropertiesDialog.cpp:360:32 [opt]
    frame #3: 0x000000010032420d ngscopeclient`Dialog::Render(this=0x0000600001824358) at Dialog.cpp:80:6 [opt]
    frame #4: 0x0000000100358137 ngscopeclient`MainWindow::RenderUI(this=0x00007fe3a2020000) at MainWindow.cpp:589:12 [opt]
    frame #5: 0x0000000100460bd3 ngscopeclient`VulkanWindow::Render(this=0x00007fe3a2020000) at VulkanWindow.cpp:458:2 [opt]
    frame #6: 0x00000001004a2c32 ngscopeclient`main(argc=<unavailable>, argv=<unavailable>) at main.cpp:127:18 [opt]
    frame #7: 0x00007ff80f946386 dyld`start + 1942
(lldb) print this
(const std::vector<std::string> *) 0x0000000000000008 size=0
(lldb) up
frame #1: 0x0000000101b5eb54 libscopehal.dylib`FlowGraphNode::GetInputCount(this=0x0000000000000000) at FlowGraphNode.cpp:128:23 [opt]
   125
   126  size_t FlowGraphNode::GetInputCount()
   127  {
-> 128      return m_signalNames.size();
   129  }
   130
   131  string FlowGraphNode::GetInputName(size_t i)
(lldb) print m_signalNames
error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory