Vector35 / debugger

Binary Ninja debugger
Other
199 stars 12 forks source link

Crash when re-selecting DebuggerView from View Type selector #279

Closed 0cyn closed 1 year ago

0cyn commented 1 year ago

Repro:

  1. Open a binary
  2. Debug it, run it, let it exit and return the view to Mach-O View
  3. Select "Debugger" from the view types image


Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000010
Exception Codes:       0x0000000000000001, 0x0000000000000010
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [65845]

VM Region Info: 0x10 is not in any region.  Bytes before following region: 140737486913520
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      VM_ALLOCATE              7fffffea0000-7fffffea1000 [    4K] r-x/r-x SM=ALI  

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libdebuggerui.dylib                    0x1169e8db4 0x116981000 + 425396
1   libdebuggerui.dylib                    0x1169ac677 0x116981000 + 177783
2   libdebuggerui.dylib                    0x1169ac358 0x116981000 + 176984
3   libdebuggerui.dylib                    0x1169ae2c1 0x116981000 + 185025
4   libdebuggerui.dylib                    0x1169dedf0 0x116981000 + 384496
5   libbinaryninjaui.1.dylib               0x102bf91be SidebarWidgetContainer::activateWidgetForType(SidebarWidgetType*) + 574
6   libbinaryninjaui.1.dylib               0x102bfa3af SidebarWidgetContainer::setActiveContext(SplitPaneWidget*, ViewFrame*, QString const&, BinaryNinja::Ref<BinaryNinja::BinaryView>) + 2319
7   libbinaryninjaui.1.dylib               0x102bfd067 Sidebar::setActiveContext(SplitPaneWidget*, ViewFrame*, QString const&, BinaryNinja::Ref<BinaryNinja::BinaryView>) + 103
8   binaryninja                            0x1007aee51 0x10073f000 + 458321
9   binaryninja                            0x1007ae62a 0x10073f000 + 456234
10  QtCore                                 0x10bc0157d void doActivate<false>(QObject*, int, void**) + 813
11  libbinaryninjaui.1.dylib               0x1029c166f SplitPaneWidget::currentChanged(Pane*) + 63
12  QtCore                                 0x10bc0157d void doActivate<false>(QObject*, int, void**) + 813
13  libbinaryninjaui.1.dylib               0x1029c101f SplitPaneContainer::currentChanged(Pane*) + 63
14  QtCore                                 0x10bc0157d void doActivate<false>(QObject*, int, void**) + 813
15  QtWidgets                              0x103102a3e QApplicationPrivate::setFocusWidget(QWidget*, Qt::FocusReason) + 558
16  QtWidgets                              0x103152908 QWidget::setFocus(Qt::FocusReason) + 616
17  libbinaryninjaui.1.dylib               0x102d2eff9 ViewFrame::setViewType(QString const&) + 89
18  libbinaryninjaui.1.dylib               0x102ba2082 ViewPane::viewChangeRequested(QString) + 130
19  libbinaryninjaui.1.dylib               0x102babb1f 0x1029b1000 + 2075423
20  QtCore                                 0x10bc0157d void doActivate<false>(QObject*, int, void**) + 813
21  libbinaryninjaui.1.dylib               0x1029c06e4 ViewPaneHeader::viewChanged(QString) + 52
22  libbinaryninjaui.1.dylib               0x102ba1852 ViewPaneHeader::viewChangeRequested(QString) + 50
23  libbinaryninjaui.1.dylib               0x102bab81f 0x1029b1000 + 2074655
24  QtCore                                 0x10bc0157d void doActivate<false>(QObject*, int, void**) + 813
25  libbinaryninjaui.1.dylib               0x1029ba3f4 DataTypeList::viewChanged(QString) + 52
26  libbinaryninjaui.1.dylib               0x102a649d9 DataTypeList::showMenu() + 1993
27  QtCore                                 0x10bc0157d void doActivate<false>(QObject*, int, void**) + 813
28  libbinaryninjaui.1.dylib               0x102b8a5c5 MenuHelper::mouseReleaseEvent(QMouseEvent*) + 37
29  QtWidgets                              0x103156eaa QWidget::event(QEvent*) + 538
30  QtWidgets                              0x1031f1f3b QFrame::event(QEvent*) + 43
31  QtWidgets                              0x1031049e7 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 247
32  QtWidgets                              0x103106e43 QApplication::notify(QObject*, QEvent*) + 5907
33  QtCore                                 0x10bbb192a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 170
34  QtWidgets                              0x1031050db QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) + 907
35  QtWidgets                              0x10316d4c2 QWidgetWindow::handleMouseEvent(QMouseEvent*) + 1634
36  QtWidgets                              0x10316c315 QWidgetWindow::event(QEvent*) + 117
37  QtWidgets                              0x1031049e7 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 247
38  QtWidgets                              0x103105926 QApplication::notify(QObject*, QEvent*) + 502
39  QtCore                                 0x10bbb192a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 170
40  QtGui                                  0x101bdae29 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 2281
41  QtGui                                  0x101c323dc QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 396
42  libqcocoa.dylib                        0x10aec5bdb QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) + 43
43  CoreFoundation                      0x7ff81459e19b __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
44  CoreFoundation                      0x7ff81459e103 __CFRunLoopDoSource0 + 180
45  CoreFoundation                      0x7ff81459de7d __CFRunLoopDoSources0 + 242
46  CoreFoundation                      0x7ff81459c898 __CFRunLoopRun + 892
47  CoreFoundation                      0x7ff81459be5c CFRunLoopRunSpecific + 562
48  HIToolbox                           0x7ff81d2435e6 RunCurrentEventLoopInMode + 292
49  HIToolbox                           0x7ff81d243213 ReceiveNextEventCommon + 283
50  HIToolbox                           0x7ff81d2430e5 _BlockUntilNextEventMatchingListInModeWithFilter + 70
51  AppKit                              0x7ff816fdb1fd _DPSNextEvent + 927
52  AppKit                              0x7ff816fd98ba -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1394
53  AppKit                              0x7ff816fcbf69 -[NSApplication run] + 586
54  libqcocoa.dylib                        0x10aec49ec QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2252
55  QtCore                                 0x10bbbb336 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 486
56  QtCore                                 0x10bbb1f25 QCoreApplication::exec() + 133
57  binaryninja                            0x1007724ac 0x10073f000 + 210092
58  dyld                                   0x11125851e start + 462
xusheng6 commented 1 year ago

The fix unregisters the debugger view from the associated filemetadata, so the debugger view would not show up in the view selector at all.