A list for the developers of CellML tools

Text archives Help


[cellml-dev] compiling Telicims


Chronological Thread 
  • From: ak.miller at auckland.ac.nz (Andrew Miller)
  • Subject: [cellml-dev] compiling Telicims
  • Date: Wed, 29 Dec 2010 14:13:10 +1300

On 29/12/10 13:50, Lucian Smith wrote:
> * Andrew Miller<ak.miller at auckland.ac.nz> [2010-12-28 23:55] writes:
>> I think that it is probably a downstream effect of some kind of memory
>> usage error earlier on corrupting things. I'd suggest running it through
>> valgrind memcheck which will probably find the original cause of the crash.
>
> Indeed, valgrind confirms that there was a memory usage error--one line
> previously, in makeUTF16 ;-)
>
> ==2772== Command: cellml2antimony
> /home/lpsmith/CellML/models/adrian_chandler_hodgkin_1970/adrian_chandler_hodgkin_1970.cellml
> ==2772==
> ==2772== Invalid write of size 4
> ==2772== at 0x471715B: __gconv_transform_ascii_internal (loop.c:332)
> ==2772== by 0x4781F4E: __mbsrtowcs_l (mbsrtowcs_l.c:124)
> ==2772== by 0x4777A49: mbsrtowcs (mbsrtowcs.c:34)
> ==2772== by 0x473513F: mbstowcs (mbstowcs.c:39)
> ==2772== by 0x80547A5: makeUTF16(std::string const&)
> (antimony_api.cpp:28)
> ==2772== by 0x8056BAA: loadCellMLFile (antimony_api.cpp:331)
> ==2772== by 0x8053A83: main (cellml2antimony.cpp:21)
> ==2772== Address 0x49c36b0 is 184 bytes inside a block of size 186 alloc'd
> ==2772== at 0x402532E: operator new[](unsigned int)
> (vg_replace_malloc.c:299)
> ==2772== by 0x8054777: makeUTF16(std::string const&)
> (antimony_api.cpp:27)
> ==2772== by 0x8056BAA: loadCellMLFile (antimony_api.cpp:331)
> ==2772== by 0x8053A83: main (cellml2antimony.cpp:21)
>
> Then after attaching to the debugger:
>
> (gdb) bt
> #0 0x0471715b in ascii_internal_loop (step=0x484fbc0, data=0xbebd9284,
> inptrp=0xbebd92b0, inend=0x49c35c1 "", outbufstart=0x0,
> irreversible=0xbebd92b4, do_flush=0, consume_incomplete=1)
> at ../iconv/loop.c:332
> #1 __gconv_transform_ascii_internal (step=0x484fbc0, data=0xbebd9284,
> inptrp=0xbebd92b0, inend=0x49c35c1 "", outbufstart=0x0,
> irreversible=0xbebd92b4, do_flush=0, consume_incomplete=1)
> at ../iconv/skeleton.c:611
> #2 0x04781f4f in __mbsrtowcs_l (
> dst=0x49c35f8 L"/home/lpsmith/CellML/models/adrian_chandler_ho",
> src=0xbebd9314, len=92, ps=0xbebd92fc, l=0x48503a0) at
> mbsrtowcs_l.c:124
> #3 0x04777a4a in __mbsrtowcs (
> dst=0x49c35f8 L"/home/lpsmith/CellML/models/adrian_chandler_ho",
> src=0xbebd9314, len=92, ps=<value optimized out>) at mbsrtowcs.c:34
> #4 0x04735140 in mbstowcs (
> pwcs=0x49c35f8 L"/home/lpsmith/CellML/models/adrian_chandler_ho",
> s=0x49c3564
> "/home/lpsmith/CellML/models/adrian_chandler_hodgkin_1970/adrian_chandler_hodgkin_1970.cellml",
> n=92) at mbstowcs.c:39
> #5 0x080547a6 in makeUTF16 (aStr=...) at src/antimony_api.cpp:28
> #6 0x08056bab in loadCellMLFile (
> filename=0xbebd9623
> "/home/lpsmith/CellML/models/adrian_chandler_hodgkin_1970/adrian_chandler_hodgkin_1970.cellml")
> at src/antimony_api.cpp:331
> #7 0x08053a84 in main (argc=2, argv=0xbebd94d4) at
>
> src/cellml2antimony.cpp:21
> (gdb) frame 5
> #5 0x080547a6 in makeUTF16 (aStr=...) at src/antimony_api.cpp:28
> 28 mbstowcs(buf, aStr.c_str(), aStr.length());
>
> I don't know anything about mbstowcs, but 'aStr' seems to be fine.

The valgrind message means that mbstowcs is writing a 32 bit character
at offset 184 of a 186 byte block of memory (invalid, since that
involves writing past the end of the block).

186 isn't a multiple of 4 - so to guess at what could be wrong: have you
used a compile flag for 16 bit wide characters (e.g. -fshort-wchars),
but linked against a glibc version that uses 32-bit wide characters (the
default for modern glibc versions)? As Mozilla is built to use 16-bit
wide characters, it is quite likely you have -fshort-wchars on, but if
linking with Mozilla was the only reason you turned it on, you don't
need it any more, and turning it off should fix that issue.

Best wishes,
Andrew

>
> -Lucian
> _______________________________________________
> cellml-tools-developers mailing list
> cellml-tools-developers at cellml.org
> http://lists.cellml.org/mailman/listinfo/cellml-tools-developers





Archive powered by MHonArc 2.6.18.

Top of page