Closed andoruB closed 9 years ago
Grepping through sources it looks like this line is causing the problem: src/wx/guiinit.cpp:2325
It's part of some strange #define do{...}while(0) loops. Since it's not actually a function call I now need to figure out wtf is going on.
Ok, I think I have a slightly better understanding of the code now. This is probably the last line of actual wxvbam code that caused the problem.
[20] wxXmlResource::LoadObject(wxWindow, wxString const&, wxString const&)
it's now on guiinit.cpp:2058 dialog = wxDynamicCast(wxXmlResource::Get()->LoadObject(theframe, dname, wxEmptyString), wxDialog);
If you could try setting a gdb breakpoint there and looking at those variables it would be a huge help. Especially since I can't reproduce this at all.
Edit: Changed the line number.
Could you explain a bit how I set that gdb breakpoint? I'm not at all versed in programming :P
I've gone ahead and uploaded a build script that should make sure that all of the needed dependencies are installed. Try running that.
After that do this: rm -r build mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Debug .. make gdb ./wxvbam break src/wx/guiinit.cpp:2058 run backtrace next print dialog quit
If you'll paste the output of that it would help a bunch.
Okay, ran the build script you made, and it seems I was missing a package, namely libwxgtk2.8-dev. But ran the executable, and it was still the same.
Not sure if you needed the output of all the commands you gave me above, or just for gdb, if you need the entire output, I'll gladly handle it to you. For now here's the gdb output: http://pastebin.com/wari6ASq
Also, when I issued next
, the "DoShowScrollbars(): window must be created" wx error popped up again, so I assumed I must click on "Continue".
This is so exciting :D
The most likely issue is that my system uses wx 2.8 instead of 3.0 I'll try to work with it some more on my end, but here are a few suggestions for now.
Try this: sudo apt-get install libwxgtk3.0-dev
Otherwise try:
git fetch git checkout remotes/origin/usewxgtk2
Also if you can try typing "step" a few times instead of next in gdb it will run you through exactly what it's doing before things fail.
$ apt-get install libwxgtk3.0-dev Reading package lists... Done Building dependency tree
Reading state information... Done libwxgtk3.0-dev is already the newest version.
$ git fetch remote: Counting objects: 5, done. remote: Compressing objects: 100% (5/5), done. remote: Total 5 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (5/5), done. From https://github.com/EmperorArthur/VBA-M x [new branch] usewxgtk2 -> origin/usewxgtk2
$ git checkout remotes/origin/userwxgtk2 error: pathspec 'remotes/origin/userwxgtk2' did not match any file(s) known to git.
As for the steps: http://pastebin.com/acLBQsz6 Did 15 steps, most of them probably unnecessary, but I just wanted to make sure :P
The reason git complained was "usewxgtk2" vs "userwxgtk2" you snuck an extra 'r' into the git checkout. I just did the same thing, so it's not a big deal.
You can just copy and paste this into your shell: "git fetch -f;git checkout remotes/origin/usewxgtk2"
Otherwise git will complain. If you want to see what I'm doing you can type "git gui&" under "Repository" click "Visualize All Branch History". It's like git log, but easier to read.
$ git fetch -f;git checkout remotes/origin/usewxgtk2 remote: Counting objects: 10, done. remote: Compressing objects: 100% (10/10), done. remote: Total 10 (delta 3), reused 0 (delta 0) Unpacking objects: 100% (10/10), done. From https://github.com/EmperorArthur/VBA-M aeb0330..30876d2 master -> origin/master
- c232ccd...40d5fe9 usewxgtk2 -> origin/usewxgtk2 (forced update) M po/gvbam/zh_TW.po M po/wxvbam/cs.po M po/wxvbam/en.po M po/wxvbam/nl.po M po/wxvbam/zh_TW.po Note: checking out 'remotes/origin/usewxgtk2'.
You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 40d5fe9... Make sure that wxwidgets uses the gtk2 version of the toolkit
What's the backtrace from compiling this version?
Also, I've changed a few things, so you're going to need to do that "git fetch -f" over again.
Here you go: http://pastebin.com/6EsQPdgA I "fetched" the latest revision as you said.
Ok, much more work has been done. Hopefully this will work for you.
"git pull -f;git checkout master"
gdb ./wxvbam break src/wx/guiinit.cpp:2092 run print anObject next print dialog continue
This line caught my eye: "warning: Source file is more recent than executable." That's normally indicative of needing to run "make" to rebuild the executable
Does the program run now? What is the error report if you don't set any breakpoints, and just run the program?
This line caught my eye: "warning: Source file is more recent than executable." That's normally indicative of needing to run "make" to rebuild the executable
I didn't think I would need to compile the emulator again, so I just updated the code and ran the commands you specified.
Here's the output after making the emu once more: http://pastebin.com/yGQ4aCFr
Does the program run now?
It does, except I get the same error after the emu starts (assert "scrolled" failed), and this time when I open any window from the Options menu, I get greeted with the "can't open user configuration file" error, while this being shown in the terminal:
*\ Caught unhandled unknown exception; terminating
After clicking Ok on the error window, the emulator closes.
What is the error report if you don't set any breakpoints, and just run the program?
Not sure if you mean doing this whithin gdb, but here you go: http://pastebin.com/26R7nNJC
I've tried to make error handling explain more about the problem. Try compiling with this code.
Also out of curiosity, does it crash when you open Jopypads from the options menu?
I'm trying to figure out what's causing this. It's frustrating because I think it's a wx Version 3 issue, but so far can't replicate it. :/
I've tried to make error handling explain more about the problem. Try compiling with this code.
Doesn't seem to work properly when using gdb... http://pastebin.com/Tkgk80rK
Also out of curiosity, does it crash when you open Jopypads from the options menu?
Yes, it prints the error with the configuration file, then closes :)
Did it still print this line, or was it more informative this time?
*\ Caught unhandled unknown exception; terminating
That GDB breakpoint is in a function. Here's an example of what's happening:
function: LoadXRCDialog(...){ ... ... // Breakpoint is right here ... } LoadXRCDialog("GBAROMInfo); LoadXRCDialog("SomeotherDialog"); LoadXRCDialog(...)
If you tell gdb to set a breakpoint it will stop for every function call to that breakpoint. you have to hit continue about ten times and then the program will run.
You actually don't need to worry about setting those breakpoints any more. What I was hoping to see was something like this:
Breakpoint 1, MainFrame::LoadXRCDialog (this=0x87526b0, name=0x8342af1 "GBAROMInfo") next ../src/gtk/scrolwin.cpp(205): assert "scrolled" failed in DoShowScrollbars(): window must be created continue
I'm trying to find what's triggering that assert, and trying to figure out what's causing the program to crash.
Did it still print this line, or was it more informative this time?
Here's what I've got while running the emulator (not with gdb):
AN ERROR HAS OCCURRED: Pointer of type "P8wxDialog" was not correctly created.
You actually don't need to worry about setting those breakpoints any more. What I was hoping to see was something like this:
Is there something specific I must do to get you the correct error?
Think of the different parts of a program as books in a library. We call these books "Objects", and give them each a catalog number, just like real books. These catalog numbers are called "Pointers".
What's happening is part of the program is given a pointer, and tries to use it to find an object, just like someone would find a book in a library. The problem is that it was not given a call number, so it doesn't know what to do and the program exits.
That's what "AN ERROR HAS OCCURRED: Pointer of type "P8wxDialog" was not correctly created." means. It's looking for a book ('object') but the program checks to make sure that it wasn't given a bad pointer. It's kind of like looking at a note with a books call number and only seeing a big ZERO written on it. You know that doesn't work.
The hard part is finding out what is passing the note with ZERO on it. Step one was to find out what was taking the note. It's a function called "ShowModal". Now we have to figure out who's passing the bad note to it.
These are all the possibilities, and I will probably end up needing to look through them all:
cd VBA-M/src/wx/ grep --colour -nd recurse -e "ShowModal" . ./gfxviewers.cpp:1045: int ret = dlg.ShowModal(); ./gfxviewers.cpp:1180: if(dlg.ShowModal() == wxID_OK) { ./viewers.cpp:497: int ret = dlg.ShowModal(); ./viewers.cpp:619: int ret = dlg.ShowModal(); ./viewers.cpp:639: if(selregion->ShowModal() != wxID_OK) ./viewers.cpp:655: if(selregion->ShowModal() != wxID_OK) ./viewers.cpp:666: int ret = dlg.ShowModal(); ./viewsupt.cpp:1026: int ret = dlg.ShowModal(); ./panel.cpp:56: dlg.ShowModal(); ./panel.cpp:108: dlg.ShowModal(); ./panel.cpp:171: dlg.ShowModal(); ./cmdevents.cpp:92: if(ShowModal(&dlg) == wxID_OK) ./cmdevents.cpp:592: ShowModal(dlg); ./cmdevents.cpp:621: ShowModal(dlg); ./cmdevents.cpp:635: int ret = ShowModal(&dlg); ./cmdevents.cpp:660: int ret = ShowModal(&dlg); ./cmdevents.cpp:724: int sel = ShowModal(seldlg); ./cmdevents.cpp:757: int ret = ShowModal(&dlg); ./cmdevents.cpp:797: int ret = ShowModal(&dlg); ./cmdevents.cpp:820: int ret = ShowModal(&dlg); ./cmdevents.cpp:832: if(ShowModal(infodlg) != wxID_OK) ./cmdevents.cpp:867: int ret = ShowModal(&dlg); ./cmdevents.cpp:944: int ret = ShowModal(&dlg); ./cmdevents.cpp:1016: int ret = ShowModal(&dlg); ./cmdevents.cpp:1051: int ret = ShowModal(&dlg); ./cmdevents.cpp:1082: int ret = ShowModal(&dlg); ./cmdevents.cpp:1174: ShowModal(dlg); ./cmdevents.cpp:1248: int ret = ShowModal(&dlg); ./cmdevents.cpp:1330: int ret = ShowModal(&dlg); ./cmdevents.cpp:1398: ShowModal(dlg); ./cmdevents.cpp:1404: ShowModal(dlg); ./cmdevents.cpp:1743: if(ShowModal(dlg) == wxID_OK) ./cmdevents.cpp:1775: if(ShowModal(dlg) != wxID_OK) ./cmdevents.cpp:1853: if(ShowModal(dlg) != wxID_OK) ./cmdevents.cpp:1983: if(ShowModal(dlg) != wxID_OK) ./cmdevents.cpp:2068: if(ShowModal(dlg) != wxID_OK) ./cmdevents.cpp:2103: if(ShowModal(dlg) == wxID_OK) ./cmdevents.cpp:2112: if(ShowModal(dlg) == wxID_OK) ./cmdevents.cpp:2124: if(ShowModal(dlg) != wxID_OK) ./cmdevents.cpp:2154: if(ShowModal(dlg) == wxID_OK) ./sys.cpp:477: int ShowModal() {CheckPointer(wxGetApp().frame); return wxGetApp().frame->ShowModal(dlg); } ./sys.cpp:600: int ret = fdlg.ShowModal(); ./sys.cpp:656: psdlg2.ShowModal(); ./sys.cpp:661: psdlg.ShowModal(); ./sys.cpp:667: pmdlg.ShowModal(); ./sys.cpp:788: int ret = dlg.ShowModal(); ./wxvbam.cpp:616:// ShowModal that also disables emulator loop ./wxvbam.cpp:618:int MainFrame::ShowModal(wxDialog dlg) ./wxvbam.cpp:622: int ret = dlg->ShowModal(); ./guiinit.cpp:278: int ret = subdlg.ShowModal(); ./guiinit.cpp:301: int ret = subdlg.ShowModal(); ./guiinit.cpp:321: subdlg->ShowModal(); ./guiinit.cpp:510: if(subdlg->ShowModal() != wxID_OK) ./guiinit.cpp:921: if(subdlg->ShowModal() != wxID_OK) ./wxvbam.h:169: // dialogs, use this function instead of dlg->ShowModal() ./wxvbam.h:170: int ShowModal(wxDialog dlg); ./wxvbam.h:171: // and here are the wrapper functions for use when ShowModal() isn't
Okay. I just took a look at what pcsx2 does, and am trying that. Run these commands in your build directory
git pull -f git checkout remotes/origin/usewxgtk2 cmake -DCMAKE_BUILD_TYPE=Debug .. make gdb ./wxvbam break src/wx/wxvbam.cpp:620 run print dlg backtrace
Also try running it without gdb and see if it still crashes.
Oh wow, not getting errors anymore, and the menu options work as intended :D When running the program within gdb, and trying to open a menu entry the program freezes, but I guess that's expected since the program is ran at a specific pointer. Anyway, here's the output: http://pastebin.com/ysxW3bn1
Since this is working for you I'll go ahead and close this out and create an enhancement issue for using wx 3.0.
Alright. Thanks for your help and for the patience you had with me in explaining everything :)
So running the wx flavour of the vbam GUI gives me "An assertion failed!" followed by:
Here's the backtrace:
Clicking on "Continue" brings up the GUI with the following error:
After that the GUI is usable, except when I open menu entries, I get yet another assertion failed error:
Clicking on "Continue" closes the GUI/emulator.
This happens to all menu entries, except "Open" and those under the "Emulation" menu.