I´m doing my first application, and I have a problem with SIGSEGV signal.
I debug my application and it runs correctly for hours, but when least
expected was caused an segmentation fault (SIGSEGV signal).
This error was produced when I try to write in a file.
The time the application is running is random (2, 3 , … 10, 11 or 12, …,
15 hours).
If you are running QNX4 with Watcom you can start the dumper utility to give
you a dump file when a process terminates, and you can then use the Watcom
debugger to find what line of the program caused the segment violation.
I´m doing my first application, and I have a problem with SIGSEGV signal.
I debug my application and it runs correctly for hours, but when least
expected was caused an segmentation fault (SIGSEGV signal).
This error was produced when I try to write in a file.
The time the application is running is random (2, 3 , … 10, 11 or 12,
…,
15 hours).
I forgot to mention that with QNX 6 (which is what you are probably running)
you should get a core file when a process crashes, and you can use gdb to
see what line caused the crash.
If you are running QNX4 with Watcom you can start the dumper utility to
give
you a dump file when a process terminates, and you can then use the Watcom
debugger to find what line of the program caused the segment violation.
I´m doing my first application, and I have a problem with SIGSEGV
signal.
I debug my application and it runs correctly for hours, but when least
expected was caused an segmentation fault (SIGSEGV signal).
This error was produced when I try to write in a file.
The time the application is running is random (2, 3 , … 10, 11 or 12,
…,
15 hours).
C. Scott <cscott@nospam.com> wrote:
CS > I forgot to mention that with QNX 6 (which is what you are probably running)
CS > you should get a core file when a process crashes, and you can use gdb to
CS > see what line caused the crash.
Also, be aware that you are probibly dereferencing a pointer that is
not (no longer) valid.
This line ‘buffer = (unsigned char)malloc(80);’ in FileCp() does fishy
casting to (unsigned char) instead of (unsigned char *). As result
‘buffer’ variable may point to somewhere else but not where you expect
it to. Sometimes you may damage data at that ‘somewhere’ location. And
maybe that’s what causes the problem in WriteVibrations(). Sometimes
your ‘buffer’ pointer can not be dereferenced atall and you get SIGSEGV
at ‘fwrite(buffer, 1, bytes, pfd);’ line.
The line should be:
buffer = (unsigned char *)malloc(80);
-dp
Jorge Alonso wrote:
Hi!
First, I work with QNX 6.
Then, I know the function and line where is caused the crash. Always it is
produced in one of this functions (although in most cases it´s in the
first):
void WriteVibrations (FILE * f)
{
unsigned short i;
int vibr;
int *pVibr;
float mg, mv;
First, I work with QNX 6.
Then, I know the function and line where is caused the crash. Always it is
produced in one of this functions (although in most cases it´s in the
first):
void WriteVibrations (FILE * f)
{
unsigned short i;
int vibr;
int *pVibr;
float mg, mv;
C. Scott <> cscott@nospam.com> > wrote:
CS > I forgot to mention that with QNX 6 (which is what you are probably
running)
CS > you should get a core file when a process crashes, and you can use
gdb to
CS > see what line caused the crash.
Also, be aware that you are probibly dereferencing a pointer that is
not (no longer) valid.
This line ‘buffer = (unsigned char)malloc(80);’ in FileCp() does fishy
casting to (unsigned char) instead of (unsigned char *). As result
‘buffer’ variable may point to somewhere else but not where you expect
it to. Sometimes you may damage data at that ‘somewhere’ location. And
maybe that’s what causes the problem in WriteVibrations(). Sometimes
your ‘buffer’ pointer can not be dereferenced atall and you get SIGSEGV
at ‘fwrite(buffer, 1, bytes, pfd);’ line.
The line should be:
buffer = (unsigned char *)malloc(80);
-dp
Jorge Alonso wrote:
Hi!
First, I work with QNX 6.
Then, I know the function and line where is caused the crash. Always it
is
produced in one of this functions (although in most cases it´s in the
first):
void WriteVibrations (FILE * f)
{
unsigned short i;
int vibr;
int *pVibr;
float mg, mv;
This line ‘buffer = (unsigned char)malloc(80);’ in FileCp() does fishy
casting to (unsigned char) instead of (unsigned char *). As result
‘buffer’ variable may point to somewhere else but not where you expect
it to. Sometimes you may damage data at that ‘somewhere’ location. And
maybe that’s what causes the problem in WriteVibrations(). Sometimes
your ‘buffer’ pointer can not be dereferenced atall and you get SIGSEGV
at ‘fwrite(buffer, 1, bytes, pfd);’ line.
The line should be:
buffer = (unsigned char *)malloc(80);
-dp
Jorge Alonso wrote:
Hi!
First, I work with QNX 6.
Then, I know the function and line where is caused the crash. Always it
is
produced in one of this functions (although in most cases it´s in the
first):
void WriteVibrations (FILE * f)
{
unsigned short i;
int vibr;
int *pVibr;
float mg, mv;
This line ‘buffer = (unsigned char)malloc(80);’ in FileCp() does fishy
casting to (unsigned char) instead of (unsigned char *). As result
‘buffer’ variable may point to somewhere else but not where you expect
it to. Sometimes you may damage data at that ‘somewhere’ location. And
maybe that’s what causes the problem in WriteVibrations(). Sometimes
your ‘buffer’ pointer can not be dereferenced atall and you get SIGSEGV
at ‘fwrite(buffer, 1, bytes, pfd);’ line.
The line should be:
buffer = (unsigned char *)malloc(80);
-dp
Jorge Alonso wrote:
Hi!
First, I work with QNX 6.
Then, I know the function and line where is caused the crash. Always it
is
produced in one of this functions (although in most cases it´s in the
first):
void WriteVibrations (FILE * f)
{
unsigned short i;
int vibr;
int *pVibr;
float mg, mv;