Project

General

Profile

Actions

Emulator Issues #8204

closed

Bug: Clicking "Add to Watch" on a register within the debugger crashes Dolphin

Added by ixtsptf about 9 years ago. Updated over 8 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Current
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

[READ THIS: https://forums.dolphin-emu.org/showthread.php?pid=276132 <<<
Your answers are there!]
[Leave the questions as they are and answer them in the next line]
[Remove lines written inside brackets [], but nothing else]

Game Name?
Any.

Game ID?
Any.

What's the problem? Describe what went wrong in few words.
Dolphin has the ability to watch memory locations for value changes. You can apparently watch registers as well. However, even when there is no game running, clicking "Add to Watch" on a register will instantly crash Dolphin.

What did you expect to happen instead?
While it might be a bit of a stretch, I expected the register to be added to the "Watch" panel in Dolphins debugger.

What steps will reproduce the problem?
[Don't assume we have ever played the game and know any level names. Be as
specific as possible.]

  1. Execute Dolphin in debug mode (Dolphin.exe -d)
  2. On the right panel (where the debugging stuff is), click on the Registers tab.
  3. Right click any register and click "Add to Watch". Dolphin should then crash.

Dolphin 3.5 and 3.5-367 are old versions of Dolphin that have
known issues and bugs, so don't report issues about them and test the
latest Dolphin version first.
Which versions of Dolphin did you test on?
Dolphin 4.0-5416 (8f4bcf3ec33e63b02e001b7256148e6f94c95da8)

Does using an older version of Dolphin solve your issue? If yes, which
versions of Dolphin used to work?
I don't believe this ever worked...

What are your PC specifications? (including, but not limited to: Operating
System, CPU and GPU)
OS: Windows 7 Home Premium SP1
GFX Card: NVidia GeForce 680 GTX
CPU: Intel 2500k @ 3.3ghz
MB: Asrock z68 extreme 3 w/ latest BIOS

Is there any other relevant information? (e.g. logs, screenshots,
configuration files)
This would be a nice feature to get working in Dolphins debugger. I'd imagine it'd make finding 60 fps patches a bit easier if I could somehow add a register to the "Watch" so that the game could pause for when that particular register hits a certain value of looking for. This way I can determine where in the game's code it might set that particular value.

Actions #1

Updated by pleonex over 8 years ago

I am having the same problem. In fact, all the context menu for the debugger views are broken. The problem is getting the parent CodeWindow. For instance for the watchpoint window is at:

CFrame* main_frame = (CFrame*)(GetParent()->GetParent());
CCodeWindow* code_window = main_frame->g_pCodeWindow; 
CWatchWindow* watch_window = code_window->m_WatchWindow; // <- Segfault

The segfault is in the third line because g_pCodeWindow is null. The problem is that main_frame is not the CFrame of the main window. The parent is good when the CWatchWindow window is created (at the constructor) but at some point later, all the windows changes of parent because of the notebook add page. That is, "this->m_parent->m_parent" is correct in the constructor of CWatchWindow, but later, that variable points to another widget. This can be easily seen with a watchpoint:

Breakpoint 7, CWatchView::CWatchView (this=0x2303ab0, parent=0x23007c0, id=-1) 
    at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/Debugger/WatchView.cpp:214
214             m_watch_table = new CWatchTable();
(gdb) print this->m_parent->m_parent
$20 = (wxWindow *) 0x1fb9b90
(gdb) print &this->m_parent->m_parent                                                                                                   
$21 = (wxWindow **) 0x2300818
(gdb) watch *0x2300818
Hardware watchpoint 8: *0x2300818
(gdb) c
Continuing.
Hardware watchpoint 8: *0x2300818

Old value = 33266576
New value = 0
wxWindowBase::SetParent (this=0x23007c0, parent=0x0)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/common/wincmn.cpp:1345
1345    }
(gdb) p/x 33266576
$23 = 0x1fb9b90
(gdb) where
#0  0x000000000099adee in wxWindowBase::SetParent(wxWindowBase*) (this=0x23007c0, parent=0x0)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/common/wincmn.cpp:1345
#1  0x000000000099ad70 in wxWindowBase::RemoveChild(wxWindowBase*) (this=0x1fb9b90, child=0x23007c0)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/common/wincmn.cpp:1330
#2  0x0000000000aa731f in wxWindow::RemoveChild(wxWindowBase*) (this=0x1fb9b90, child=0x23007c0)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/gtk/window.cpp:3468
#3  0x000000000099ae5c in wxWindowBase::Reparent(wxWindowBase*) (this=0x23007c0, newParent=0x22e5560)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/common/wincmn.cpp:1361
#4  0x0000000000aa6f2c in wxWindow::Reparent(wxWindowBase*) (this=0x23007c0, newParentBase=0x22e5560)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/gtk/window.cpp:3418
#5  0x000000000085bf25 in wxAuiNotebook::InsertPage(unsigned long, wxWindow*, wxString const&, bool, wxBitmap const&) (this=0x22e5560, page_idx=1, page=0x23007c0, caption=..., select=true, bitmap=...)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/aui/auibook.cpp:1930
#6  0x000000000085be4d in wxAuiNotebook::AddPage(wxWindow*, wxString const&, bool, wxBitmap const&) (this=0x22e5560, page=0x23007c0, caption=..., select=true, bitmap=...)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/aui/auibook.cpp:1917
#7  0x00000000005b4b15 in CFrame::DoAddPage(wxWindow*, int, bool) (this=0x1fb9b90, Win=0x23007c0, i=0, Float=false)
    at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/FrameAui.cpp:467
#8  0x0000000000575261 in CCodeWindow::ToggleWatchWindow(bool) (this=0x1f86a70, bShow=true)
    at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp:592
#9  0x0000000000574e81 in CCodeWindow::OpenPages() (this=0x1f86a70)
    at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp:542
#10 0x00000000005b6130 in CFrame::ReloadPanes() (this=0x1fb9b90)
    at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/FrameAui.cpp:728
#11 0x00000000005b6166 in CFrame::DoLoadPerspective() (this=0x1fb9b90)
    at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/FrameAui.cpp:736
#12 0x00000000005a94e0 in CFrame::CFrame(wxFrame*, int, wxString const&, wxPoint const&, wxSize const&, bool, bool, bool, long) (this=0x1fb9b90, parent=0x0, id=-1, title=..., pos=..., size=..., _UseDebugger=true, _BatchMode=false, ShowLo
gWindow=false, style=541072960) at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/Frame.cpp:462
#13 0x0000000000613ab7 in DolphinApp::OnInit() (this=0x1f624d0)
    at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/Main.cpp:152
#14 0x00000000006159b3 in wxAppConsoleBase::CallOnInit() (this=0x1f624d0)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/include/wx/app.h:93
#15 0x00000000009172bc in wxEntry(int&, wchar_t**) (argc=@0x189fb10: 4, argv=0x1f621e0)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/common/init.cpp:479
#16 0x0000000000917348 in wxEntry(int&, char**) (argc=@0x7fffffffd9ac: 4, argv=0x7fffffffda98)
    at /lab/romhacking/emulators/dolphin/Externals/wxWidgets3/src/common/init.cpp:507
#17 0x00000000006136ec in main(int, char**) (argc=4, argv=0x7fffffffda98)
    at /lab/romhacking/emulators/dolphin/Source/Core/DolphinWX/Main.cpp:80

ixtsptf wrote:

[READ THIS: https://forums.dolphin-emu.org/showthread.php?pid=276132 <<<
Your answers are there!]
[Leave the questions as they are and answer them in the next line]
[Remove lines written inside brackets [], but nothing else]

Game Name?
Any.

Game ID?
Any.

What's the problem? Describe what went wrong in few words.
Dolphin has the ability to watch memory locations for value changes. You can apparently watch registers as well. However, even when there is no game running, clicking "Add to Watch" on a register will instantly crash Dolphin.

What did you expect to happen instead?
While it might be a bit of a stretch, I expected the register to be added to the "Watch" panel in Dolphins debugger.

What steps will reproduce the problem?
[Don't assume we have ever played the game and know any level names. Be as
specific as possible.]

  1. Execute Dolphin in debug mode (Dolphin.exe -d)
  2. On the right panel (where the debugging stuff is), click on the Registers tab.
  3. Right click any register and click "Add to Watch". Dolphin should then crash.

Dolphin 3.5 and 3.5-367 are old versions of Dolphin that have
known issues and bugs, so don't report issues about them and test the
latest Dolphin version first.
Which versions of Dolphin did you test on?
Dolphin 4.0-5416 (8f4bcf3ec33e63b02e001b7256148e6f94c95da8)

Does using an older version of Dolphin solve your issue? If yes, which
versions of Dolphin used to work?
I don't believe this ever worked...

What are your PC specifications? (including, but not limited to: Operating
System, CPU and GPU)
OS: Windows 7 Home Premium SP1
GFX Card: NVidia GeForce 680 GTX
CPU: Intel 2500k @ 3.3ghz
MB: Asrock z68 extreme 3 w/ latest BIOS

Is there any other relevant information? (e.g. logs, screenshots,
configuration files)
This would be a nice feature to get working in Dolphins debugger. I'd imagine it'd make finding 60 fps patches a bit easier if I could somehow add a register to the "Watch" so that the game could pause for when that particular register hits a certain value of looking for. This way I can determine where in the game's code it might set that particular value.

Actions #2

Updated by pleonex over 8 years ago

This is fixed changing:

CFrame* main_frame = (CFrame*)(GetParent()->GetParent());

to:

CFrame* main_frame = (CFrame*)(GetParent()->GetParent()->GetParent());

But I am not sure if this is always like this.

Actions #3

Updated by JosJuice over 8 years ago

  • Status changed from New to Fix pending
  • Milestone set to Current
Actions #4

Updated by JosJuice over 8 years ago

  • Status changed from Fix pending to Fixed
Actions

Also available in: Atom PDF