Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault #3006

Closed
katananja opened this issue Jan 4, 2018 · 10 comments
Closed

Segmentation fault #3006

katananja opened this issue Jan 4, 2018 · 10 comments

Comments

@katananja
Copy link
Contributor

Debian 9 x64, GCC 6.3.0
mame0193-270-g4afcdbcda3-dirty

Thread 1 "mame64d" received signal SIGSEGV, Segmentation fault.
─── Assembly ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
0x000055555df14e10 debug_view::set_visible_size+32 incb   0x6b(%rdi)
0x000055555df14e13 debug_view::set_visible_size+35 movb   $0x1,0x6c(%rdi)
0x000055555df14e17 debug_view::set_visible_size+39 mov    $0x1,%esi
0x000055555df14e1c debug_view::set_visible_size+44 callq  *0x20(%rax)
0x000055555df14e1f debug_view::set_visible_size+47 movzbl 0x6b(%rbx),%eax
0x000055555df14e23 debug_view::set_visible_size+51 cmp    $0x1,%al
0x000055555df14e25 debug_view::set_visible_size+53 je     0x55555df14e50 <debug_view::set_visible_size(debug_view_xy)+96>
─── Expressions ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── History ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Memory ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Registers ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   rax 0x0000000000000000    rbx 0x000055556433bbb0    rcx 0x0000555564344e80    rdx 0x0000000000000312    rsi 0x0000000000000001    rdi 0x000055556433bbb0    rbp 0x00007fffffff57e0    rsp 0x00007fffffff57a0
    r8 0x0000555564859ee0     r9 0x0000000000000000    r10 0x00007fffffff3910    r11 0x0000000000000000    r12 0x00007fffffff5880    r13 0x00007ffff5fe1f60    r14 0x00007fffffff5878    r15 0x0000000000000000
   rip 0x000055555df14e1c eflags [ IF RF ]              cs 0x00000033             ss 0x0000002b             ds 0x00000000             es 0x00000000             fs 0x00000000             gs 0x00000000        
─── Source ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
145     if (size.x != m_visible.x || size.y != m_visible.y)
146     {
147         begin_update();
148         m_visible = size;
149         m_update_pending = true;
150         view_notify(VIEW_NOTIFY_VISIBLE_CHANGED);
151         end_update();
152     }
153 }
154 
155 
─── Stack ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[0] from 0x000055555df14e1c in debug_view::set_visible_size+44 at ../../../../../src/emu/debug/debugvw.cpp:150
arg this = 0x55556433bbb0
arg size = <optimized out>
[1] from 0x000055555bbef6a9 in DebuggerView::paintEvent at ../../../../../src/osd/modules/debugger/qt/debuggerview.cpp:54
arg this = 0x555564336480
arg event = <optimized out>
[+]
─── Threads ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1] id 3722 name mame64d from 0x000055555df14e1c in debug_view::set_visible_size+44 at ../../../../../src/emu/debug/debugvw.cpp:150
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
0x000055555df14e1c in debug_view::set_visible_size (this=0x55556433bbb0, size=...) at ../../../../../src/emu/debug/debugvw.cpp:150
150			view_notify(VIEW_NOTIFY_VISIBLE_CHANGED);
>>> thread 1
[Switching to thread 1 (Thread 0x7ffff7f28940 (LWP 3722))]
#0  0x000055555df14e1c in debug_view::set_visible_size (this=0x55556433bbb0, size=...) at ../../../../../src/emu/debug/debugvw.cpp:150
150			view_notify(VIEW_NOTIFY_VISIBLE_CHANGED);
>>> bt
#0  0x000055555df14e1c in debug_view::set_visible_size (this=0x55556433bbb0, size=...) at ../../../../../src/emu/debug/debugvw.cpp:150
#1  0x000055555bbef6a9 in DebuggerView::paintEvent (this=0x555564336480, event=<optimized out>) at ../../../../../src/osd/modules/debugger/qt/debuggerview.cpp:54
#2  0x00007ffff6850278 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#3  0x00007ffff6938a0e in QFrame::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#4  0x00007ffff5f25741 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff6808b65 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#6  0x00007ffff6810341 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7  0x00007ffff5f259e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007ffff6848fda in QWidgetPrivate::sendPaintEvent(QRegion const&) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff6849646 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff6818f1e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff6819147 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff6837f8f in QWidgetPrivate::syncBackingStore() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff6850348 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007ffff694f92b in QMainWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007ffff6808b8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff6810341 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff5f259e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff5f2816d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff5f79c43 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007fffef8207f7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007fffef820a60 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007fffef820b0c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007ffff5f7a04f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#24 0x00007ffff5f25ae1 in QCoreApplication::processEvents(QFlags<QEventLoop::ProcessEventsFlag>, int) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#25 0x000055555bbe97d0 in debug_qt::debugger_update (this=<optimized out>) at ../../../../../src/osd/modules/debugger/debugqt.cpp:363
#26 0x000055555bb1f746 in osd_common_t::debugger_update (this=<optimized out>) at ../../../../../src/osd/modules/lib/osdobj_common.cpp:520
#27 0x000055555bb11e8e in sdl_osd_interface::update (this=0x7fffffffdba0, skip_redraw=<optimized out>) at ../../../../../src/osd/sdl/video.cpp:118
#28 0x000055555e16a112 in video_manager::frame_update (this=0x55556648b600, from_debugger=from_debugger@entry=false) at ../../../../../src/emu/video.cpp:229
#29 0x000055555bc5d12a in mame_ui_manager::set_startup_text (this=0x555566bc8de0, text=<optimized out>, force=<optimized out>) at ../../../../../src/frontend/mame/ui/ui.cpp:382
#30 0x000055555bc02d0d in mame_machine_manager::create_ui (this=0x55556436aa90, machine=...) at ../../../../../src/frontend/mame/mame.cpp:288
#31 0x000055555e0d412d in running_machine::start (this=this@entry=0x7fffffff6a90) at ../../../../../src/emu/machine.cpp:218
#32 0x000055555e0d577d in running_machine::run (this=this@entry=0x7fffffff6a90, quiet=quiet@entry=false) at ../../../../../src/emu/machine.cpp:310
#33 0x000055555bc05b4a in mame_machine_manager::execute (this=this@entry=0x55556436aa90) at ../../../../../src/frontend/mame/mame.cpp:236
#34 0x000055555bca24a5 in cli_frontend::start_execution (this=this@entry=0x7fffffffd9a0, manager=manager@entry=0x55556436aa90, args=std::vector of length 3, capacity 3 = {...}) at ../../../../../src/frontend/mame/clifront.cpp:257
#35 0x000055555bca2a3e in cli_frontend::execute (this=this@entry=0x7fffffffd9a0, args=std::vector of length 3, capacity 3 = {...}) at ../../../../../src/frontend/mame/clifront.cpp:273
#36 0x000055555bc03813 in emulator_info::start_frontend (options=..., osd=..., args=std::vector of length 3, capacity 3 = {...}) at ../../../../../src/frontend/mame/mame.cpp:336
#37 0x0000555559373c36 in main (argc=<optimized out>, argv=<optimized out>) at ../../../../../src/osd/sdl/sdlmain.cpp:216
@katananja
Copy link
Contributor Author

mame0193-274-ga8308ca31c-dirty
make DEBUG=1 SYMBOLS=1 SYMLEVEL=1 STRIP_SYMBOLS=1 -j8

@rb6502
Copy link
Contributor

rb6502 commented Jan 4, 2018

Please give actual steps for this (including a complete command line), it's not happening for me on either Fedora 27 or macOS 10.12.6.

@katananja
Copy link
Contributor Author

This is the debug window crashing.

gdb mame64d
run -debug sf2ce
Quit debug window

@katananja
Copy link
Contributor Author

Could some one test this?

  1. gdb mame64d
  2. run -debug -window sf2ce
  3. Debug Hard Reset Shift+F3

Thank you.

@firewave
Copy link
Contributor

firewave commented Jan 5, 2018

==79916==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e00008c4e8 at pc 0x00000e068561 bp 0x7ffea323b660 sp 0x7ffea323b658
READ of size 4 at 0x60e00008c4e8 thread T0
    #0 0xe068560 in debug_view::set_visible_size(debug_view_xy) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/debug/debugvw.cpp:145:26
    #1 0x8c94ff2 in DebuggerView::paintEvent(QPaintEvent*) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/debugger/qt/debuggerview.cpp:54:10
    #2 0x7f0b8a03cfc7 in QWidget::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x19dfc7)
    #3 0x7f0b8a13bb8d in QFrame::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x29cb8d)
    #4 0x7f0b89707171 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x286171)
    #5 0x7f0b89ffa03b in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x15b03b)
    #6 0x7f0b89fff515 in QApplication::notify(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x160515)
    #7 0x7f0b8970738a in QCoreApplication::notifyInternal(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x28638a)
    #8 0x7f0b8a035ab8 in QWidgetPrivate::sendPaintEvent(QRegion const&) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x196ab8)
    #9 0x7f0b8a036100 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x197100)
    #10 0x7f0b8a007855  (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x168855)
    #11 0x7f0b8a007a8b  (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x168a8b)
    #12 0x7f0b8a025c5e in QWidgetPrivate::syncBackingStore() (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x186c5e)
    #13 0x7f0b8a03cdc7 in QWidget::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x19ddc7)
    #14 0x7f0b8a152dba in QMainWindow::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x2b3dba)
    #15 0x7f0b89ffa05b in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x15b05b)
    #16 0x7f0b89fff515 in QApplication::notify(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x160515)
    #17 0x7f0b8970738a in QCoreApplication::notifyInternal(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x28638a)
    #18 0x7f0b89709785 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x288785)
    #19 0x7f0b8975d3c2  (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2dc3c2)
    #20 0x7f0b84615196 in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a196)
    #21 0x7f0b846153ef  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a3ef)
    #22 0x7f0b8461549b in g_main_context_iteration (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a49b)
    #23 0x7f0b8975d7ce in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2dc7ce)
    #24 0x7f0b89707469 in QCoreApplication::processEvents(QFlags<QEventLoop::ProcessEventsFlag>, int) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x286469)
    #25 0x8c86b4f in debugger_update /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/debugger/debugqt.cpp:363:2
    #26 0x8c86b4f in non-virtual thunk to debug_qt::debugger_update() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/debugger/debugqt.cpp
    #27 0x8af880b in osd_common_t::debugger_update() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/lib/osdobj_common.cpp:520:30
    #28 0x8ad2e6a in sdl_osd_interface::update(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/video.cpp:118:3
    #29 0xe833517 in video_manager::frame_update(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:229:18
    #30 0x8d9203f in mame_ui_manager::set_startup_text(char const*, bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/ui/ui.cpp:382:21
    #31 0x8cd2af0 in mame_machine_manager::create_ui(running_machine&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:288:8
    #32 0xe69f851 in running_machine::start() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:218:19
    #33 0xe6a2a41 in running_machine::run(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:310:3
    #34 0x8cd10e0 in mame_machine_manager::execute() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:236:19
    #35 0x8e1e0d3 in cli_frontend::start_execution(mame_machine_manager*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:257:22
    #36 0x8e20ee0 in cli_frontend::execute(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:273:3
    #37 0x8cd3717 in emulator_info::start_frontend(emu_options&, osd_interface&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:336:18
    #38 0x8acddf2 in main /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:216:9
    #39 0x7f0b87f0d82f in __libc_start_main /build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:291
    #40 0x1431838 in _start (/mnt/mame/mame64_as+0x1431838)

0x60e00008c4e8 is located 72 bytes inside of 160-byte region [0x60e00008c4a0,0x60e00008c540)
freed by thread T0 here:
    #0 0x14fe342 in operator delete(void*) /opt/media/clang_nightly/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/asan_new_delete.cc:137:3
    #1 0xe08d845 in debug_view_console::~debug_view_console() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/debug/dvtext.h:51:7
    #2 0xe069ab3 in debug_view_manager::~debug_view_manager() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/debug/debugvw.cpp:330:3
    #3 0xe69e77f in operator() /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:76:2
    #4 0xe69e77f in ~unique_ptr /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:236
    #5 0xe69e77f in running_machine::~running_machine() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:168
    #6 0x8cd14a5 in mame_machine_manager::execute() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:257:2
    #7 0x8e1e0d3 in cli_frontend::start_execution(mame_machine_manager*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:257:22
    #8 0x8e20ee0 in cli_frontend::execute(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:273:3
    #9 0x8cd3717 in emulator_info::start_frontend(emu_options&, osd_interface&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:336:18
    #10 0x8acddf2 in main /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:216:9
    #11 0x7f0b87f0d82f in __libc_start_main /build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:291

previously allocated by thread T0 here:
    #0 0x14fd722 in operator new(unsigned long) /opt/media/clang_nightly/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/asan_new_delete.cc:92:3
    #1 0xe069b24 in debug_view_manager::alloc_view(debug_view_type, void (*)(debug_view&, void*), void*) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/debug/debugvw.cpp:344:18
    #2 0x8c94163 in DebuggerView::DebuggerView(debug_view_type const&, running_machine*, QWidget*) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/debugger/qt/debuggerview.cpp:31:35
    #3 0x8c9c9d5 in MainWindow::MainWindow(running_machine*, QWidget*) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/debugger/qt/mainwindow.cpp:38:22
    #4 0x8c81df7 in debug_qt::wait_for_debugger(device_t&, bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/debugger/debugqt.cpp:295:22
    #5 0x8c86b0f in non-virtual thunk to debug_qt::wait_for_debugger(device_t&, bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/debugger/debugqt.cpp
    #6 0x8af87a9 in osd_common_t::wait_for_debugger(device_t&, bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/lib/osdobj_common.cpp:515:14
    #7 0xe05356d in device_debug::instruction_hook(unsigned int) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/debug/debugcpu.cpp:1751:19
    #8 0xe0bd736 in debugger_instruction_hook(device_t*, unsigned int) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/debugger.cpp:35:20
    #9 0xb132dbb in m68000_base_device::execute_run() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/cpu/m68000/m68kcpu.cpp:797:4
    #10 0xb13582f in non-virtual thunk to m68000_base_device::execute_run() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/cpu/m68000/m68kcpu.cpp
    #11 0xe78e2db in run /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/diexec.h:188:15
    #12 0xe78e2db in device_scheduler::timeslice() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:485
    #13 0xe6a324b in running_machine::run(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:357:17
    #14 0x8cd10e0 in mame_machine_manager::execute() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:236:19
    #15 0x8e1e0d3 in cli_frontend::start_execution(mame_machine_manager*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:257:22
    #16 0x8e20ee0 in cli_frontend::execute(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:273:3
    #17 0x8cd3717 in emulator_info::start_frontend(emu_options&, osd_interface&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:336:18
    #18 0x8acddf2 in main /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:216:9
    #19 0x7f0b87f0d82f in __libc_start_main /build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:291

SUMMARY: AddressSanitizer: heap-use-after-free /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/debug/debugvw.cpp:145:26 in debug_view::set_visible_size(debug_view_xy)
Shadow bytes around the buggy address:
  0x0c1c80009840: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c1c80009850: 00 00 00 02 fa fa fa fa fa fa fa fa 00 00 00 00
  0x0c1c80009860: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
  0x0c1c80009870: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c1c80009880: 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa
=>0x0c1c80009890: fa fa fa fa fd fd fd fd fd fd fd fd fd[fd]fd fd
  0x0c1c800098a0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x0c1c800098b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c800098c0: fa fa fa fa fa fa fa fa fa fa fa fa 00 00 00 00
  0x0c1c800098d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
  0x0c1c800098e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb

@katananja
Copy link
Contributor Author

Thanks @firewave

@mizapf
Copy link
Member

mizapf commented May 20, 2020

The issue seems to be still there (mame0221).

Shift-F3 triggers a SIGSEGV while debugger is open. It seems to occur only when the emulation window has focus (not the debugger window).

#1  0x0000000000c28994 in debug_view::set_visible_size (this=0x4a497e0, size=...)
    at ../../../../../src/emu/debug/debugvw.cpp:149
#2  0x00000000005a295c in DebuggerView::paintEvent (this=0x49d33e0, event=0x7fffffff5420)
    at ../../../../../src/osd/modules/debugger/qt/debuggerview.cpp:57
#3  0x00007ffff77995ae in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#4  0x00007ffff784800e in QFrame::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#5  0x00007ffff6c4ccf3 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ()
   from /usr/lib64/libQt5Core.so.5
#6  0x00007ffff7756c9e in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#7  0x00007ffff775fdf0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#8  0x00007ffff6c4cfe2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#9  0x00007ffff7791c46 in QWidgetPrivate::sendPaintEvent(QRegion const&) () from /usr/lib64/libQt5Widgets.so.5

@firewave
Copy link
Contributor

I am not able to reproduce this with 0.249 on Windows or Linux, Also no UBSAN/ASAN errors.

@mizapf
Copy link
Member

mizapf commented Nov 15, 2022

Yes, seems to be gone. Works for me too.

@cuavas
Copy link
Member

cuavas commented Nov 15, 2022

This is a duplicate of #9789 (or vice versa) – fixed by 76541e8. The Qt debugger was trying to free resources from the previous run on start. It could still do with some refactoring, but this particular issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants