- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a small test project for boost serialize.
When running the release version of the test project the program runs till the end.
When setting a breakpoint in the release version in BoostSerialize.cpp line 332 then i get
"Unhandled exception at 0x00364645 in BoostSerialize.exe: 0xC000001D: Illegal Instruction."
I am using VS2010, Intel Compiler 14.0 SP1 and boost 1.54, static linked. boost is compiled with the following settings:
using intel : 14.0 : $(intel-compiler-14)/bin/ia32/icl.exe : <compatibility>vc10 <cxxflags>"/Qstd=c++11 /Qipo /Qdiag-disable:2586 /D_CRT_SECURE_NO_WARNINGS" ;
The test project is attached as zip file.
The problem can be reproduced on different PC's (Win7x64 pro, i7 and Xeon)
Bernhard
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no specific instructionset selected. The exception is only thrown when setting a breakpoint in line 332 of BoostSerialize.cpp.
Compile settings:
/I"C:\Libs\boost\boost_1_54_0\include" /Zi /nologo /W3 /O3 /Qipo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /EHsc /GS /Zc:wchar_t /Zc:forScope /Fp"Release\BoostSerialize.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gd
Linker settings:
/OUT:"C:\project\spielwiese\BoostSerialize - Copy\Release\BoostSerialize.exe" /NOLOGO /LIBPATH:"C:\Libs\boost\boost_1_54_0\lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Release\BoostSerialize.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\project\spielwiese\BoostSerialize - Copy\Release\BoostSerialize.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is usually signaled by CPU as a invalid opcode exception(can be related perhaps to prefixes).Could be caused by compiler while emmiting unsupported instruction.As Sergey advised please look at assembly code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for the long delay - i was some days not in the office.
When running the code on my desktop pc (Win7x64, Intel Xeon E5-1607) i got the following:
After selecting "Go to disassembly" i got the following message box:
and the assembler code:
Running the same per remote debugger on Win7x86 Embedded, Celeron Dual-Core T3100, i got the same result.
When running the program without any breakpoint everything works correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the assembler code when running on Intel Xeon E5-1607
325: save_data_binary(data_container,filename.c_str());
00B5462B add esp,0FFFFFFF0h
00B5462E lea edx,[filename]
00B54634 cmp dword ptr [ebp-8Ch],10h
00B5463B lea eax,[data_container]
00B54641 db 0fh
00B54642 inc ebx
330:
331: // restore the data_container
332: test_data_container restored_data_container;
00B54643 xchg eax,ebp <== Breakpoint
00B54644 pushad
00B54645 db ffh <== Instructionpointer
00B54646 db ffh
00B54647 dec dword ptr [ecx+54892404h]
00B5464D and al,4
00B5464F call save_data_binary (0B610E0h)
00B54654 add esp,10h
326: save_data_string(data_container,filename.c_str());
00B54657 add esp,0FFFFFFF0h
00B5465A lea edx,[filename]
00B54660 cmp dword ptr [ebp-8Ch],10h
00B54667 lea eax,[data_container]
00B5466D cmovae edx,dword ptr [filename]
00B54674 mov dword ptr [esp],eax
00B54677 mov dword ptr [esp+4],edx
00B5467B call save_data_string (0B60050h)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>>00B54645 db ffh <== Instructionpointer
00B54646 db ffh >>>
This looks like not properly disassembled code.Also pay attention to this machine code line >>>00B54647 dec dword ptr [ecx+54892404h]>>> the offset looks a way to big.It seems that exception is thrown when the breakpoint is set.Do you know what breakpoint it is?I mean int 0x3 or writing to debug registers.
I suppose that compiler might have inserted two byte opcode of int 0x3 instruction.That's mean 0xCD03 instead of 0xCC.
Can you post machine code at this location?:00B54643
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am thinking how to see what opcode of breakpoint was emmited by VS debugger.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I deleted all breakpoints and started the program with F10 in VS2010. Then i attach with windgb to the process. Windbg shows the following assembler code:
00c745d7 83c4f0 add esp,0FFFFFFF0h
00c745da 83fa10 cmp edx,10h
00c745dd 8d9560ffffff lea edx,[ebp-0A0h]
00c745e3 0f439560ffffff cmovae edx,dword ptr [ebp-0A0h]
00c745ea 8d85c0fdffff lea eax,[ebp-240h]
00c745f0 890424 mov dword ptr [esp],eax
00c745f3 89542404 mov dword ptr [esp+4],edx
00c745f7 e8c4e30000 call BoostSerialize!save_data_text (00c829c0)
00c745fc 83c410 add esp,10h
00c745ff 83c4f0 add esp,0FFFFFFF0h
00c74602 8d9560ffffff lea edx,[ebp-0A0h]
00c74608 83bd74ffffff10 cmp dword ptr [ebp-8Ch],10h
00c7460f 8d85c0fdffff lea eax,[ebp-240h]
00c74615 0f439560ffffff cmovae edx,dword ptr [ebp-0A0h]
00c7461c 890424 mov dword ptr [esp],eax
00c7461f 89542404 mov dword ptr [esp+4],edx
00c74623 e888d00000 call BoostSerialize!save_data_xml (00c816b0)
00c74628 83c410 add esp,10h
00c7462b 83c4f0 add esp,0FFFFFFF0h
00c7462e 8d9560ffffff lea edx,[ebp-0A0h]
00c74634 83bd74ffffff10 cmp dword ptr [ebp-8Ch],10h
00c7463b 8d85c0fdffff lea eax,[ebp-240h]
00c74641 0f439560ffffff cmovae edx,dword ptr [ebp-0A0h]
00c74648 890424 mov dword ptr [esp],eax
00c7464b 89542404 mov dword ptr [esp+4],edx
00c7464f e88cca0000 call BoostSerialize!save_data_binary (00c810e0)
00c74654 83c410 add esp,10h
00c74657 83c4f0 add esp,0FFFFFFF0h
00c7465a 8d9560ffffff lea edx,[ebp-0A0h]
00c74660 83bd74ffffff10 cmp dword ptr [ebp-8Ch],10h
00c74667 8d85c0fdffff lea eax,[ebp-240h]
00c7466d 0f439560ffffff cmovae edx,dword ptr [ebp-0A0h]
00c74674 890424 mov dword ptr [esp],eax
00c74677 89542404 mov dword ptr [esp+4],edx
00c7467b e8d0b90000 call BoostSerialize!save_data_string (00c80050)
after setting the breakpoint at line 332 within VS2010 windbg shows the following assembler code:
00c745d7 83c4f0 add esp,0FFFFFFF0h
00c745da 83fa10 cmp edx,10h
00c745dd 8d9560ffffff lea edx,[ebp-0A0h]
00c745e3 0f439560ffffff cmovae edx,dword ptr [ebp-0A0h]
00c745ea 8d85c0fdffff lea eax,[ebp-240h]
00c745f0 890424 mov dword ptr [esp],eax
00c745f3 89542404 mov dword ptr [esp+4],edx
00c745f7 e8c4e30000 call BoostSerialize!save_data_text (00c829c0)
00c745fc 83c410 add esp,10h
00c745ff 83c4f0 add esp,0FFFFFFF0h
00c74602 8d9560ffffff lea edx,[ebp-0A0h]
00c74608 83bd74ffffff10 cmp dword ptr [ebp-8Ch],10h
00c7460f 8d85c0fdffff lea eax,[ebp-240h]
00c74615 0f439560ffffff cmovae edx,dword ptr [ebp-0A0h]
00c7461c 890424 mov dword ptr [esp],eax
00c7461f 89542404 mov dword ptr [esp+4],edx
00c74623 e888d00000 call BoostSerialize!save_data_xml (00c816b0)
00c74628 83c410 add esp,10h
00c7462b 83c4f0 add esp,0FFFFFFF0h
00c7462e 8d9560ffffff lea edx,[ebp-0A0h]
00c74634 83bd74ffffff10 cmp dword ptr [ebp-8Ch],10h
00c7463b 8d85c0fdffff lea eax,[ebp-240h]
00c74641 0f43cc cmovae ecx,esp
00c74644 60 pushad
00c74645 ff ???
00c74646 ff ???
00c74647 ff8904248954 dec dword ptr [ecx+54892404h]
00c7464d 2404 and al,4
00c7464f e88cca0000 call BoostSerialize!save_data_binary (00c810e0)
00c74654 83c410 add esp,10h
00c74657 83c4f0 add esp,0FFFFFFF0h
00c7465a 8d9560ffffff lea edx,[ebp-0A0h]
00c74660 83bd74ffffff10 cmp dword ptr [ebp-8Ch],10h
00c74667 8d85c0fdffff lea eax,[ebp-240h]
00c7466d 0f439560ffffff cmovae edx,dword ptr [ebp-0A0h]
00c74674 890424 mov dword ptr [esp],eax
00c74677 89542404 mov dword ptr [esp+4],edx
00c7467b e8d0b90000 call BoostSerialize!save_data_string (00c80050)
Now i see that VS2010 debugger is setting the breakpoint (int3 == 0xcc) at a complete wrong position.
But who is responsible for this behaviour? The debugger of VS2010 or the intel compiler (pdb files?) ?
@Sergey
Thanks to your hint.
I will check if #pragma intel optimization_parameter target_arch is used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
there is no #pragma intel in my sources of boost 1.54
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>>Actually Yes and No since I had similar cases, that is, Illegal Instruction exception, on a system with Pentium 4 processor when by mistake I tried to execute an application compiled with support of AVX instructions>>>
In your case it was expected because CPU did not recognize the AVX instructions encoding hence invalid instruction exception was thrown.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>>00c74645 ff ???
00c74646 ff ??? >>>
Is this a location of the breakpoint?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>>Now i see that VS2010 debugger is setting the breakpoint (int3 == 0xcc) at a complete wrong position.
But who is responsible for this behaviour? The debugger of VS2010 or the intel compiler (pdb files?) ?>>>
At least you verified that used breakpoint is translated to 0xCC.Usually debugging thread opens process memory space and overwrites(inserts) the code with int3 opcodes.It could be also inserted by compiler when you have hardcoded breakpoints in your code.Possibly by using inline assembly or DebugBreak() function.
Take into account also Sergey's explanation it seems very logical.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page