|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-03-06 10:26:45
"Vladimir Prus" <ghost_at_[hidden]> wrote in message
news:200603061503.31801.ghost_at_cs.msu.su...
>
> Hi,
> an application of mine just suddenly crashed before entering 'main', with
> the
> following stacktrace:
>
> #5 0xb7eb7106 in __cxa_throw () from /usr/lib/libstdc++.so.5
> #6 0xb7e6ccb0 in std::__throw_runtime_error ()
> from /usr/lib/libstdc++.so.5
> #7 0xb7eb5c8e in std::locale::facet::_S_create_c_locale ()
> from /usr/lib/libstdc++.so.5
> #8 0xb7e96554 in std::locale::_Impl::_Impl ()
> from /usr/lib/libstdc++.so.5
> #9 0xb7e768e9 in std::locale::locale () from /usr/lib/libstdc++.so.5
> #10 0xb78f6922 in __static_initialization_and_destruction_0
> (__initialize_p=1, __priority=65535)
> at /space/NM/boost/libs/filesystem/src/path.cpp:29
>
> And the line in question contains just:
>
> 29 std::locale loc("");
>
> This is CVS as of today. The problem was that I incorrectly set the
> LC_MESSAGES environment variable. However, I think that exception from
> static
> object is not so good idea. I can't catch it, so the error reporting just
> reads "Aborted".
Ah! This may expain so other error reports of aborts before main() has
started.
> Maybe, this can be converted into a function with static variable, so that
> the
> static variable is only initialized on the first call?
OK, this has been changed in CVS. Please try it with the same LC_MESSAGES
problem, and let me know if the exception occurs at a more appropriate time.
I'm also wondering if the path.cpp code should catch the exception and call
boost::throw_exception() with a filesystem_error. What do you think about
doing that? Would it have made diagnosing the problem easier for you?
Thanks very much for the detailed report and suggested fix. That is ever so
much more helpful than a bald "it crashed" report.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk