This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: " throw logic error" abort, but print no error message out
- From: Bernd Roesch <nospamname at web dot de>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>, Bernd Roesch <nospamname at web dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 15 Nov 2008 12:52:32 +0200
- Subject: Re: " throw logic error" abort, but print no error message out
Hello Jonathan
On 14.11.08, you wrote:
>If exceptions are enabled
> __throw_logic_error will throw std::logic_error, otherwise it will
> call abort().
On the amigaos compiler is sjlj enabled, i see in asm debugger after
single
stepping long it call std::logic_error.but this func do nothing print.
so i simplyfy the testprogram and see std::logic_error("test\n"); does not
output anything.
I test this too on cygwin gcc 3.4 x86 compiler(on amigaos i use 4.3.2
compiler and the attached libstdc++).Its the same output(cout and assert
work ok) but std::logic_error not.
i look to find in sourcecode the place where logic_error do any action and
print out text, but i dont find a print command.
maybe you can tell me the place where logic_error do action to print, so i
can set a breakpoint on that
place and singlestep to see whats go wrong.
-----------------------the testprog ------------------------------
#include <iostream>
#include <stdexcept>
int main(int argc, char *argv[])
{
std::cout<<"Hallo World\n";
std::logic_error("test\n");
assert(0);
}
If so assert does not work when
> 2008/11/12 Bernd Roesch:
>>
>> But in libstdc++v3/src/functexcept.cc
>>
>> void
>> __throw_logic_error(const char*)
>> { std::abort(); }
>>
>> this call abort and there is no string print out, because abort get no
>> Parameter as far i see.
>>
>> How can this work ?
>
> It works by calling abort(), as intended.
>
> If you take another look in functexcept.cc you'll see that when
> __EXCEPTIONS is defined the following definition is used:
>
> void
> __throw_logic_error(const char* __s)
> { throw logic_error(_(__s)); }
>
> This allows the library to call __throw_logic_error without caring
> whether the target supports exceptions, or whether they have been
> disabled with -fno-exceptions. If exceptions are enabled
> __throw_logic_error will throw std::logic_error, otherwise it will
> call abort().
>
> It seems that the 68k amigaos port does not support exceptions, or
> your GCC was configured without support for exceptions.
>
> Hope that helps,
>
> Jonathan
Regards