Hi everybody,
First, I'm not sure if the "dev" mailing-list is the right place as I
don't feel like I'm "participating". So please, forgive me if I'm at the
wrong place.
I'm currently trying to use Xerces by cross-compiling it with Mingw
(hosting on Debian Linux). The problem is that I get an "illegal
instruction" in XMLPlatformUtils::Initialize() when testing it on the
target host. I searched for hours on the web for this issue, but nothing
helped me.
Here the test code:
=====================================================================
#include <xercesc/parsers/SAXParser.hpp>
XERCES_CPP_NAMESPACE_USE
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
XMLPlatformUtils::Initialize();
{
SAXParser parser;
parser.setValidationScheme(SAXParser::Val_Always);
parser.setDoNamespaces(true);
parser.setDoSchema(true);
parser.setValidationSchemaFullChecking(false);
}
XMLPlatformUtils::Terminate();
return 0;
}
=====================================================================
And here is a gdb output on the target host:
=====================================================================
C:\gdb\bin>gdb \Download\main.exe
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from \Download\main.exe...done.
(gdb) r
Starting program: \Download\main.exe
[New Thread 3064.0xf74]
Program received signal SIGILL, Illegal instruction.
0x004b0c54 in xercesc_3_1::RangeToken::expand (this=0x240ab70, length=2)
at xercesc/util/regx/RangeToken.cpp:817
817 unsigned int minNewMax = (unsigned int)((double)fElemCount *
1.25);
(gdb) bt
#0 0x004b0c54 in xercesc_3_1::RangeToken::expand (this=0x240ab70, length=2)
at xercesc/util/regx/RangeToken.cpp:817
#1 0x004b0dd0 in xercesc_3_1::RangeToken::addRange (this=0x240ab70,
start=2800, end=2917) at xercesc/util/regx/RangeToken.cpp:368
#2 0x004b0b97 in xercesc_3_1::RangeToken::complementRanges (tok=0x240aa58,
tokFactory=0x24019e0, manager=0x3e4ea8)
at xercesc/util/regx/RangeToken.cpp:757
#3 0x004b21dd in xercesc_3_1::XMLRangeFactory::buildRanges (this=0x2407378,
rangeTokMap=0x2401538) at xercesc/util/regx/XMLRangeFactory.cpp:130
#4 0x0042d297 in xercesc_3_1::RangeTokenMap::buildTokenRanges (
this=0x2401538) at xercesc/util/regx/RangeTokenMap.cpp:247
#5 0x0042dc1b in xercesc_3_1::XMLInitializer::initializeRangeTokenMap ()
at xercesc/util/regx/RangeTokenMap.cpp:49
#6 0x0040852a in xercesc_3_1::XMLInitializer::initializeStaticData ()
at xercesc/util/XMLInitializer.cpp:51
#7 0x00402d75 in xercesc_3_1::XMLPlatformUtils::Initialize (
locale=0x708842 "en_US", nlsHome=0x0, panicHandler=0x0,
memoryManager=0x0)
at xercesc/util/PlatformUtils.cpp:307
#8 0x004013bd in main (argc=1, argv=0x3e4ec8) at main.cpp:10
(gdb) list
812 void RangeToken::expand(const unsigned int length) {
813
814 unsigned int newMax = fElemCount + length;
815
816 // Avoid too many reallocations by expanding by a percentage
817 unsigned int minNewMax = (unsigned int)((double)fElemCount *
1.25);
818 if (newMax < minNewMax)
819 newMax = minNewMax;
820
821 XMLInt32* newList = (XMLInt32*) fMemoryManager->allocate
(gdb) disas
Dump of assembler code for function _ZN11xercesc_3_110RangeToken6expandEj:
0x004b0c40 <+0>: push %ebp
0x004b0c41 <+1>: mov %esp,%ebp
0x004b0c43 <+3>: push %edi
0x004b0c44 <+4>: push %esi
0x004b0c45 <+5>: push %ebx
0x004b0c46 <+6>: sub $0x3c,%esp
0x004b0c49 <+9>: mov 0x8(%ebp),%ebx
0x004b0c4c <+12>: mov 0x14(%ebx),%eax
0x004b0c4f <+15>: movd 0x14(%ebx),%xmm0
=> 0x004b0c54 <+20>: movq %xmm0,-0x20(%ebp)
0x004b0c59 <+25>: fnstcw -0x22(%ebp)
0x004b0c5c <+28>: fildll -0x20(%ebp)
0x004b0c5f <+31>: fmuls 0x750d50
0x004b0c65 <+37>: add 0xc(%ebp),%eax
0x004b0c68 <+40>: movzwl -0x22(%ebp),%edx
0x004b0c6c <+44>: mov $0xc,%dh
0x004b0c6e <+46>: mov %dx,-0x24(%ebp)
0x004b0c72 <+50>: fldcw -0x24(%ebp)
0x004b0c75 <+53>: fistpll -0x30(%ebp)
0x004b0c78 <+56>: fldcw -0x22(%ebp)
0x004b0c7b <+59>: mov -0x30(%ebp),%esi
0x004b0c7e <+62>: cmp %esi,%eax
0x004b0c80 <+64>: cmovae %eax,%esi
0x004b0c83 <+67>: mov 0x28(%ebx),%eax
0x004b0c86 <+70>: lea 0x0(,%esi,4),%ecx
0x004b0c8d <+77>: mov (%eax),%edx
0x004b0c8f <+79>: mov %ecx,0x4(%esp)
0x004b0c93 <+83>: mov %eax,(%esp)
0x004b0c96 <+86>: call *0xc(%edx)
0x004b0c99 <+89>: mov 0x14(%ebx),%edx
0x004b0c9c <+92>: test %edx,%edx
0x004b0c9e <+94>: mov %eax,%edi
0x004b0ca0 <+96>: je 0x4b0cd2
<_ZN11xercesc_3_110RangeToken6expandEj+146>
0x004b0ca2 <+98>: mov 0x20(%ebx),%eax
0x004b0ca5 <+101>: xor %edx,%edx
0x004b0ca7 <+103>: mov (%eax,%edx,4),%ecx
0x004b0caa <+106>: mov %ecx,(%edi,%edx,4)
0x004b0cad <+109>: add $0x1,%edx
0x004b0cb0 <+112>: cmp %edx,0x14(%ebx)
0x004b0cb3 <+115>: ja 0x4b0ca7
<_ZN11xercesc_3_110RangeToken6expandEj+103>
0x004b0cb5 <+117>: mov 0x28(%ebx),%edx
0x004b0cb8 <+120>: mov (%edx),%ecx
0x004b0cba <+122>: mov %eax,0x4(%esp)
0x004b0cbe <+126>: mov %edx,(%esp)
0x004b0cc1 <+129>: call *0x10(%ecx)
0x004b0cc4 <+132>: mov %edi,0x20(%ebx)
0x004b0cc7 <+135>: mov %esi,0x18(%ebx)
0x004b0cca <+138>: add $0x3c,%esp
0x004b0ccd <+141>: pop %ebx
0x004b0cce <+142>: pop %esi
0x004b0ccf <+143>: pop %edi
0x004b0cd0 <+144>: pop %ebp
0x004b0cd1 <+145>: ret
0x004b0cd2 <+146>: mov 0x20(%ebx),%eax
0x004b0cd5 <+149>: jmp 0x4b0cb5
<_ZN11xercesc_3_110RangeToken6expandEj+117>
End of assembler dump.
=====================================================================
What could be wrong?
Please note that I'm using mingw-cross-env for this purpose
(http://mingw-cross-env.nongnu.org/) and the thing builds Xerces
successfully.
Thanks in advance for your help.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]