printf

Hi,

We have been using Watcom C 10.6 compiler with QNX 4.25. We have
observed that some of our programs which use “printf” function terminate
(SIGSEGV). Tried using dumper and could observe that programs terminate on
printf function. What could be the problem? How to resolve this?
printf used in all of our programs do not make the application fail.
This is in particular to a few programs only…Do we need to utilise any
specific compiler options (for stacks, memory models, etc)

Thanks,
Krupa

Adam Mallory wrote:

There are no special options you need to specify, in order to use printf().
If you’re SIGSEGV’ing when doing a printf, most likely you’ve just passed a
bad pointer to printf, and it just followed it.

Or you didn’t pass a pointer at all to printf.

i.e. printf("%s %s %s\n", s1, s2); // oops forgot s3

mismatched format specifiers/arguments happen all too often…

Rennie

There are no special options you need to specify, in order to use printf().
If you’re SIGSEGV’ing when doing a printf, most likely you’ve just passed a
bad pointer to printf, and it just followed it.

\

Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>
“Krupa” <seto@vsnl.com> wrote in message news:agc5pp$7u7$1@inn.qnx.com

Hi,

We have been using Watcom C 10.6 compiler with QNX 4.25. We have
observed that some of our programs which use “printf” function terminate
(SIGSEGV). Tried using dumper and could observe that programs terminate
on
printf function. What could be the problem? How to resolve this?
printf used in all of our programs do not make the application fail.
This is in particular to a few programs only…Do we need to utilise any
specific compiler options (for stacks, memory models, etc)

Thanks,
Krupa
\

“Adam Mallory” <amallory@qnx.com> wrote in message
news:agc6ji$c0m$1@nntp.qnx.com

There are no special options you need to specify, in order to use
printf().
If you’re SIGSEGV’ing when doing a printf, most likely you’ve just passed
a
bad pointer to printf, and it just followed it.

Or you are using it inside a signal handler.


Cheers,
Adam

QNX Software Systems Ltd.
[ > amallory@qnx.com > ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <> pschon@baste.magibox.net
“Krupa” <> seto@vsnl.com> > wrote in message news:agc5pp$7u7$> 1@inn.qnx.com> …
Hi,

We have been using Watcom C 10.6 compiler with QNX 4.25. We have
observed that some of our programs which use “printf” function
terminate
(SIGSEGV). Tried using dumper and could observe that programs terminate
on
printf function. What could be the problem? How to resolve this?
printf used in all of our programs do not make the application fail.
This is in particular to a few programs only…Do we need to utilise
any
specific compiler options (for stacks, memory models, etc)

Thanks,
Krupa


\

In a SIGSEGV handler :slight_smile:


Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>
“Mario Charest” postmaster@127.0.0.1 wrote in message
news:agca8t$bli$1@inn.qnx.com

“Adam Mallory” <> amallory@qnx.com> > wrote in message
news:agc6ji$c0m$> 1@nntp.qnx.com> …
There are no special options you need to specify, in order to use
printf().
If you’re SIGSEGV’ing when doing a printf, most likely you’ve just
passed
a
bad pointer to printf, and it just followed it.

Or you are using it inside a signal handler.


\

Cheers,
Adam

QNX Software Systems Ltd.
[ > amallory@qnx.com > ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <> pschon@baste.magibox.net
“Krupa” <> seto@vsnl.com> > wrote in message
news:agc5pp$7u7$> 1@inn.qnx.com> …
Hi,

We have been using Watcom C 10.6 compiler with QNX 4.25. We have
observed that some of our programs which use “printf” function
terminate
(SIGSEGV). Tried using dumper and could observe that programs
terminate
on
printf function. What could be the problem? How to resolve this?
printf used in all of our programs do not make the application
fail.
This is in particular to a few programs only…Do we need to utilise
any
specific compiler options (for stacks, memory models, etc)

Thanks,
Krupa




\