Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - abort() in 6.4.1: (6 Items)
   
abort() in 6.4.1  
a little prg2.c
#include <stdio.h>
#include <stdlib.h>
char buffer[1000];
int main()
{
 long long b, a = -0x3AFAFAFAFAFAFAFALL;
 int i;
   for( i = 0; i < 100; ++i )
      buffer[i] = '0';
   sprintf (buffer, "%llu", a);
   sscanf (buffer, "%llu", &b);
   printf( "a      = %llu \n", a );
   printf( "buffer = %s \n", buffer );
   printf( "b      = %llu \n", b );
   abort();
}

qcc/gcc -o prg2 prg2.c

# ./prg2
a      = -4249985154237004538
buffer = -4249985154237004538
b      = -4249985154237004538
Abort (core dumped)
# gdb prg2
GNU gdb 6.8 qnx-nto (rev. 297)
Copyright (C) 2008 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 "i386-pc-nto-qnx6.4.0"...
(gdb) start
Temporary breakpoint 1 at 0x8048701: file prg2.c, line 6.
Starting program: /home/GCC/4.4/prg2

Temporary breakpoint 1, main () at prg2.c:6
6        long long b, a = -0x3AFAFAFAFAFAFAFALL;
(gdb) b 11
Breakpoint 2 at 0x804872b: file prg2.c, line 11.
(gdb) c
Continuing.

Breakpoint 2, main () at prg2.c:11
11         sprintf (buffer, "%lld", a);
(gdb) s
12         sscanf (buffer, "%lld", &b);
(gdb)
13         printf( "a      = %lld \n", a );
(gdb)
a      = -4249985154237004538
14         printf( "buffer = %s \n", buffer );
(gdb)
buffer = -4249985154237004538
15         printf( "b      = %lld \n", b );
(gdb)
b      = -4249985154237004538
16         abort();
(gdb)

Program received signal SIGABRT, Aborted.
0xb033da61 in SignalKill () from /usr/qnx641/target/qnx6/x86/lib/libc.so.3
(gdb)
Single stepping until exit from function SignalKill,
which has no line number information.

Program exited normally.
(gdb)

And in /var/dumps I see prg2.core
Why ????
Re: abort() in 6.4.1  
On QNX6.4.1 release nothing changed.
abort() does not work.
Re: abort() in 6.4.1  
abort() works just fine - it's just that gdb is trapping the signal before it gets delivered to the process.  Check 
whether SIGABRT is passed to the client process by default - info signal SIGABRT will tell you, and handle signal 
SIGABRT will let you specify the specifics of the signal handling.
Re: abort() in 6.4.1  
Colin abort() not works.
I'am testing abort using examples from Neutrino Library References.
prg1.c:
#inclede <stdlib.h>
 int main( void )
{
   int major_error = 1;
   if( major_error )
       abort();
   /* You'll never get here. */
   return EXIT_SUCCESS;
}

results is the same:
gcc -o prg1 prg1.c
./prg1
Abort (core dumped) 
Re: abort() in 6.4.1  
What's the bug?  That's exactly what is supposed to happen!

bogdan celer wrote:
> Colin abort() not works.
> I'am testing abort using examples from Neutrino Library References.
> prg1.c:
> #inclede <stdlib.h>
>  int main( void )
> {
>    int major_error = 1;
>    if( major_error )
>        abort();
>    /* You'll never get here. */
>    return EXIT_SUCCESS;
> }
> 
> results is the same:
> gcc -o prg1 prg1.c
> ./prg1
> Abort (core dumped) 
> 
> _______________________________________________
> QNX Software Development Platform Pre-Releases
> http://community.qnx.com/sf/go/post30395
> 

-- 
cburgess@qnx.com
Re: abort() in 6.4.1  
Yes You are right Colin.