Author Topic: unknown exception  (Read 60063 times)

grv575

  • Guest
unknown exception
« on: December 16, 2005, 02:35:25 am »
Compiled latest svn, set debugger settings to show debugger log, closed cb, started it again and I get the unknown exception dialog every time.  Went away after I opened CB revision 1512 (binary downloaded) to reset the cb settings.  Closed rev 1512, reopened latest svn cb and it starts this time.  Don't know exactly what threw the exception...

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: unknown exception
« Reply #1 on: December 16, 2005, 02:40:38 am »
You compiled it with unicode support?

http://forums.codeblocks.org/index.php?topic=1618.0
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

grv575

  • Guest
Re: unknown exception
« Reply #2 on: December 16, 2005, 02:41:44 am »
Actually, it comes up whenever I'm clicking on a wxSmith.cbp project now.  Maybe it has something to do with:

Code
Compiling: app.cpp
Linking executable: wxSmithproject.exe
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.4\..\..\..\..\mingw32\bin\ld.exe: cannot open output file wxSmithproject.exe: Permission denied
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 23 seconds)
0 errors, 0 warnings

And wxSmithproject.exe is in the Task Manager (but not in the task bar -- looks like it didn't exit cleanly for whatever reason).

grv575

  • Guest
Re: unknown exception
« Reply #3 on: December 16, 2005, 02:49:31 am »
Ok, had nothing to do with the exe still running (was a gdb session that didn't terminate cleanly).

But what's odd is that I get the unknown exception every time I launch the svn version.
Then if I open the 1512 version, close that, and then open the svn version it opens fine.  But once I close it (thus letting it save settings) it will not reopen again.  So is it saving some setting that it can't read properly?

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: unknown exception
« Reply #4 on: December 16, 2005, 02:54:22 am »
Ok, had nothing to do with the exe still running (was a gdb session that didn't terminate cleanly).

But what's odd is that I get the unknown exception every time I launch the svn version.
Then if I open the 1512 version, close that, and then open the svn version it opens fine.  But once I close it (thus letting it save settings) it will not reopen again.  So is it saving some setting that it can't read properly?

If you read my thread I was having trouble where once it created the default.conf file it would crash. It sounds like you're having the same thing happen.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

grv575

  • Guest
Re: unknown exception
« Reply #5 on: December 16, 2005, 03:09:55 am »
I'll check that in a second.  But the gdb thing seems like a bug:

I create a new wxWidgets project, compile it, run it, no problems.  Then goto debug->start and it brings up the wxWidgets sample app main window.  When I close that gdb does not exit.  It's in an endless loop:

Code
Command-line: C:\MinGW\bin\gdb.exe -nx -fullname  -args wxwidgets.exe
Working dir : C:\Documents and Settings\coke.COKE-31670BAFF9\Desktop\New Folder (2)\1\
> set prompt (gdb)
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(no debugging symbols found)
(gdb) (gdb)
> set confirm off
(gdb)
> set width 0
(gdb)
> set height 0
(gdb)
> set breakpoint pending on
(gdb)
> set print asm-demangle on
(gdb)
> set disassembly-flavor intel
(gdb)
> directory C:/DOCUME~1/COKE~1.COK/Desktop/NEWFOL~2/1/
(gdb)
> delete
(gdb)
> run
DBG_CONTINUE);
ContinueDebug
Event (cpid=3548, ctid=1868, DBG_CONTINUE);
ON_DEBUG_EVENT)
id=3548 tid=1868 code=EXCEPTION_DEBUG_EVENT)
NUE);
EVENT)
id=1868 code=EXCEPTION_DEBUG_EVENT)
gdb
: kernel event for pid=3548 tid=1868 code=EXCEPTION_DEBUG_EVENT)
ctid=1868, DBG_CONTINUE);
Co
ntinueDebugEvent (cpid=3548, ctid=1868, DBG_CONTINUE);
ode=EXCEPTION_DEBUG_EVENT)
event for pid=3548 tid=1868 code=EXCEPTION_DEBUG_EVENT)
, DBG_CONTINUE);
ContinueDeb
ugEvent (cpid=3548, ctid=1868, DBG_CONTINUE);
TION_DEBUG_EVENT)
 pid=3548 tid=1868 code=EXCEPTION_DEBUG_EVENT)
TINUE);
cpid=3548, ctid=1868, DBG_CONTINUE);
G_EVENT)
 tid=1868 code=EXCEPTION_DEBUG_EVENT)
g
db: kernel event for pid=3548 tid=1868 code=EXCEPTION_DEBUG_EVENT)
, ctid=1868, DBG_CONTINUE);
 code=EXCEPTION_DEBUG_EVENT)
l event for pid=3548 tid=1868 code=EXCEPTION_DEBUG_EVENT)
68, DBG_CONTINUE);
...(forever until I kill gdb.exe)...

grv575

  • Guest
Re: unknown exception
« Reply #6 on: December 16, 2005, 03:22:39 am »
The unknown exception problem definately has something to do with the codeblocks default.conf parsing.  It's very repeatable:

1.  delete default.conf
2.  select gcc as default compiler again, turn off tips on startup
3.  settings->debugger->enable display debugger log
4.  close cb
5.  open cb
6.  no problems yet
7.  close cb
8.  open cb
9.  not problems yet (??? odd)
10. close cb
11. open cb = unhandled exception
12. open cb = unhandled exception
...

If I leave the unhandled exception dialog box open long enough, dr mingw pops up, but only gives:

Code
codeblocks.exe caused an Access Violation at location 60538f8e in module codeblocks.dll Reading from location 00000308.

Registers:
eax=01441870 ebx=013c8850 ecx=00000001 edx=00000308 esi=004a5030 edi=0022f150
eip=00000000 esp=0022fff8 ebp=00000000 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202

Call stack:
00000000

Jumped the gun, finally it produced a .rpt:

Code
-------------------

Error occured on Thursday, December 15, 2005 at 21:21:13.

C:\1\src\devel\codeblocks.exe caused an Access Violation at location 60538f8e in module C:\1\src\devel\codeblocks.dll Reading from location 00000308.

Registers:
eax=01441870 ebx=013c8850 ecx=00000001 edx=00000308 esi=004a5030 edi=0022f150
eip=60538f8e esp=0022ef50 ebp=0022ef68 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202

Call stack:
60538F8E  C:\1\src\devel\codeblocks.dll:60538F8E  EditorManager::GetActiveEditor()  C:/1/src/sdk/editormanager.cpp:628
00459D87  C:\1\src\devel\codeblocks.exe:00459D87
00406EF3  C:\1\src\devel\codeblocks.exe:00406EF3  CodeBlocksApp::OnAppActivate(wxActivateEvent&)  C:/1/src/src/app.cpp:734
100AA0E8  C:\1\src\devel\wxmsw26u_gcc_cb.dll:100AA0E8  _ZN12wxEvtHandler21ProcessEventIfMatchesERK21wxEventTableEntryBasePS_R7wxEvent
100AA4AC  C:\1\src\devel\wxmsw26u_gcc_cb.dll:100AA4AC  _ZN16wxEventHashTable11HandleEventER7wxEventP12wxEvtHandler
100AB489  C:\1\src\devel\wxmsw26u_gcc_cb.dll:100AB489  _ZN12wxEvtHandler12ProcessEventER7wxEvent
1018413C  C:\1\src\devel\wxmsw26u_gcc_cb.dll:1018413C  _ZN9wxAppBase9SetActiveEbP8wxWindow
1011466E  C:\1\src\devel\wxmsw26u_gcc_cb.dll:1011466E  _ZN8wxWindow13MSWWindowProcEjjl
101390FA  C:\1\src\devel\wxmsw26u_gcc_cb.dll:101390FA  _ZN7wxFrame13MSWWindowProcEjjl
1010C750  C:\1\src\devel\wxmsw26u_gcc_cb.dll:1010C750  _Z9wxWndProcP6HWND__jjl@16
77D48709  C:\WINDOWS\system32\USER32.dll:77D48709  GetDC
77D487EB  C:\WINDOWS\system32\USER32.dll:77D487EB  GetDC
77D4B368  C:\WINDOWS\system32\USER32.dll:77D4B368  DefWindowProcW
77D4B3B4  C:\WINDOWS\system32\USER32.dll:77D4B3B4  DefWindowProcW
7C90EAE3  C:\WINDOWS\system32\ntdll.dll:7C90EAE3  KiUserCallbackDispatcher
77D493DF  C:\WINDOWS\system32\USER32.dll:77D493DF  PeekMessageW
77D6E92B  C:\WINDOWS\system32\USER32.dll:77D6E92B  CallMsgFilterW
77D5688A  C:\WINDOWS\system32\USER32.dll:77D5688A  LoadBitmapA
77D6B7C5  C:\WINDOWS\system32\USER32.dll:77D6B7C5  SoftModalMessageBox
77D6B12B  C:\WINDOWS\system32\USER32.dll:77D6B12B  MessageBoxIndirectA
77D95FDF  C:\WINDOWS\system32\USER32.dll:77D95FDF  MessageBoxTimeoutW
77D80574  C:\WINDOWS\system32\USER32.dll:77D80574  MessageBoxExW
77D9615B  C:\WINDOWS\system32\USER32.dll:77D9615B  MessageBoxW
1005159D  C:\1\src\devel\wxmsw26u_gcc_cb.dll:1005159D  _Z17wxSafeShowMessageRK8wxStringS1_
004044BC  C:\1\src\devel\codeblocks.exe:004044BC  CodeBlocksApp::OnInit()  C:/1/src/src/app.cpp:408
0045800C  C:\1\src\devel\codeblocks.exe:0045800C
100437F9  C:\1\src\devel\wxmsw26u_gcc_cb.dll:100437F9  _Z14wxUninitializev
100B33BA  C:\1\src\devel\wxmsw26u_gcc_cb.dll:100B33BA  _Z7wxEntryP11HINSTANCE__S0_Pci
0040148A  C:\1\src\devel\codeblocks.exe:0040148A  WinMain  C:/1/src/src/app.cpp:297
004522EA  C:\1\src\devel\codeblocks.exe:004522EA
004011E7  C:\1\src\devel\codeblocks.exe:004011E7
00401238  C:\1\src\devel\codeblocks.exe:00401238
7C816D4F  C:\WINDOWS\system32\kernel32.dll:7C816D4F  RegisterWaitForInputIdle
« Last Edit: December 16, 2005, 03:26:27 am by grv575 »

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: unknown exception
« Reply #7 on: December 16, 2005, 03:39:04 am »
Haha that's the same place (function) mine was crashing, only mine didn't give a line number I don't think!
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

grv575

  • Guest
Re: unknown exception
« Reply #8 on: December 16, 2005, 03:41:52 am »
OK traced the bug by comparing default.conf files at various stages.

A default conf file with these lines does not load (gives the exception):
Code
        <main_frame>
            <layout>
                <TOOLBAR_SHOW bool="1" />
                <LEFT_BLOCK_SELECTION int="0" />
                <BOTTOM_BLOCK_SELECTION int="0" />
                <MAXIMIZED bool="1" />
            </layout>
            <LAYOUT>
                <bin crc="0">FQAAAHd4RG9ja2luZy1TdHJlYW0tdjEuMAgAAAA8bGF5b3V0PgIAAAAFAAAAZnJhbWVAAAAAQAAAAMgAAAA2AgAAAAEAAAAACAAAAExlZnRIb3N0AgAAAGQxYAAAAGAAAAAYAwAAlgAAAAABAAAAAAoAAABCb3R0b21Ib3N0BAAAAAcAAABUb3BIb3N0lgAAAAAAAAAAAAAACgAAAEJvdHRvbUhvc3SWAAAAAAAAAAEAAAACAAAAZDEIAAAATGVmdEhvc3TIAAAAAAAAAAEAAAAFAAAAZnJhbWUJAAAAUmlnaHRIb3N0yAAAAAAAAAAAAAAAFgAAAHd4U2xpZGVCYXItU3RyZWFtLXYxLjABAAAAAAgAAAA8bGF5b3V0PgMAAAAEAAAATWFpbgEIAAAAQ29tcGlsZXIBCAAAAERlYnVnZ2VyAQ==</bin>
            </LAYOUT>
        </main_frame>

Note the crc of 0.  If I change that one line to:

Code
                <bin crc="2111425552">FQAAAHd4RG9ja2luZy1TdHJlYW0tdjEuMAgAAAA8bGF5b3V0PgIAAAAFAAAAZnJhbWVAAAAAQAAAAMgAAAA2AgAAAAEAAAAACAAAAExlZnRIb3N0AgAAAGQxYAAAAGAAAAAYAwAAlgAAAAABAAAAAAoAAABCb3R0b21Ib3N0BAAAAAcAAABUb3BIb3N0lgAAAAAAAAAAAAAACgAAAEJvdHRvbUhvc3SWAAAAAAAAAAEAAAACAAAAZDEIAAAATGVmdEhvc3TIAAAAAAAAAAEAAAAFAAAAZnJhbWUJAAAAUmlnaHRIb3N0yAAAAAAAAAAAAAAAFgAAAHd4U2xpZGVCYXItU3RyZWFtLXYxLjABAAAAAAgAAAA8bGF5b3V0PgMAAAAEAAAATWFpbgEIAAAAQ29tcGlsZXIBCAAAAERlYnVnZ2VyAQ==</bin>

Which is the value it had previously, then it load up again fine.  But on shutdown it again puts a 0 for the crc.  This is the only difference that makes it crash vs not.  Looks like something wrong with the crc calculation not getting run or...?

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: unknown exception
« Reply #9 on: December 16, 2005, 03:42:10 am »
It's obvious. Unchecked pointer.

Code
if(!m_pNotebook) return 0;
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

grv575

  • Guest
Re: unknown exception
« Reply #10 on: December 16, 2005, 07:28:09 am »
Adding that (editormanager.cpp:628) null check doesn't stop it from going off!

The odd thing is that it's the line
if (sel == -1)

that dies and triggers the exception (not the line above it):

Code
0x60538f8c <_ZN13EditorManager15GetActiveEditorEv+54>:  mov    eax,DWORD PTR [ebp+8]
0x60538f8f <_ZN13EditorManager15GetActiveEditorEv+57>:  mov    eax,DWORD PTR [eax+56]
0x60538f92 <_ZN13EditorManager15GetActiveEditorEv+60>:  mov    edx,DWORD PTR [eax]
0x60538f94 <_ZN13EditorManager15GetActiveEditorEv+62>:  add    edx,0x308
0x60538f9a <_ZN13EditorManager15GetActiveEditorEv+68>:  mov    eax,DWORD PTR [ebp+8]
0x60538f9d <_ZN13EditorManager15GetActiveEditorEv+71>:  mov    eax,DWORD PTR [eax+56]
0x60538fa0 <_ZN13EditorManager15GetActiveEditorEv+74>:  mov    DWORD PTR [esp],eax
0x60538fa3 <_ZN13EditorManager15GetActiveEditorEv+77>:  mov    eax,DWORD PTR [edx]
0x60538fa5 <_ZN13EditorManager15GetActiveEditorEv+79>:  call   eax
0x60538fa7 <_ZN13EditorManager15GetActiveEditorEv+81>:  mov    DWORD PTR [ebp-4],eax
0x60538faa <_ZN13EditorManager15GetActiveEditorEv+84>:  cmp    DWORD PTR [ebp-4],0xffffffff

(gdb) si
gdb: child_resume.SetThreadContext: thread 1432.0xaec
ContinueDebugEvent (cpid=1432, ctid=2796, DBG_CONTINUE);
gdb: kernel event for pid=1432 tid=2796 code=EXCEPTION_DEBUG_EVENT)
gdb: Target exception EXCEPTION_SINGLE_STEP at 0x60538fa5
0x60538fa5      629         if (sel == -1)
(gdb) si
gdb: child_resume.SetThreadContext: thread 1432.0xaec
ContinueDebugEvent (cpid=1432, ctid=2796, DBG_CONTINUE);
gdb: kernel event for pid=1432 tid=2796 code=EXCEPTION_DEBUG_EVENT)
gdb: Target exception EXCEPTION_SINGLE_STEP at 0xfeeefeee
0xfeeefeee in ?? ()

Not sure why it's making a function call (call [eax]) to get sel off the stack...?

right before it crashes:
Code
(gdb) 
gdb: child_resume.SetThreadContext: thread 3400.0x144
ContinueDebugEvent (cpid=3400, ctid=324, DBG_CONTINUE);
gdb: kernel event for pid=3400 tid=324 code=EXCEPTION_DEBUG_EVENT)
gdb: Target exception EXCEPTION_SINGLE_STEP at 0x60538fa3
0x60538fa3      629     ;
(gdb) i r
eax            0x17252b8        24269496
ecx            0x1      1
edx            0x211bbf8        34716664
ebx            0x13d4cb8        20794552
esp            0x22eca4 0x22eca4
ebp            0x22ecbc 0x22ecbc
esi            0x4a5030 4870192
edi            0x22eea4 2289316
eip            0x60538fa3       0x60538fa3
eflags         0x202    514
cs             0x1b     27
ss             0x23     35
ds             0x23     35
es             0x23     35
fs             0x3b     59
gs             0x0      0
(gdb) p sel
$19 = 2289316
(gdb) p/x
$20 = 0x22eea4

so sel never gets assigned to (it's the same value at the beginning of the function).

m_pNotebook is valid (non null) though:

p m_pNotebook
$25 = (struct wxNotebook *) 0x1725008

p &m_pNotebook->GetSelection()
does crash gdb though....accessing 0x00000000, so something's not right.

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: unknown exception
« Reply #11 on: December 16, 2005, 07:34:44 am »
How did you get it to load in the debugger??

I keep getting this  :x :x

http://forums.codeblocks.org/index.php?topic=1653.0

Only this time it's not with bf2.cpp, it's with the Code::Blocks files.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

grv575

  • Guest
Re: unknown exception
« Reply #12 on: December 16, 2005, 07:38:11 am »
hum.  just out of curiosity I changed it to:

Code
EditorBase* EditorManager::GetActiveEditor()
{
    SANITY_CHECK(0L);
    ///int sel = m_pNotebook->GetSelection();
    int sel;
    sel = m_pNotebook->GetSelection();
    if (sel == -1)
        return 0;

sdk/editormanager.cpp:628

And now it runs flawlessly, no more exception.  So 1) is there something about local variable initializers that I don't get...why aren't they equivalent???   and 2) can the code be changed to not use a default initializer and use the old c89 (?) style like above?  Seems to fix the problem (but I'd still like to know why).


Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: unknown exception
« Reply #13 on: December 16, 2005, 07:43:04 am »
They are equivalent. You have a buffer overflow corrupting your memory somewhere and that line changed the code enough that you aren't seeing it... for now. But it's still there.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

grv575

  • Guest
Re: unknown exception
« Reply #14 on: December 16, 2005, 08:30:47 am »
Yeah, I just changed it back and forth, and now it compiles to the same code...so no idea