Operating System - HP-UX
1753781 Members
7472 Online
108799 Solutions
New Discussion юеВ

Program is hanging intermittently

 
Sup
Advisor

Program is hanging intermittently

Hi,

Program is hanging intermittently on HP11.
Gdb output is pasted bekow.

(gdb) where
#0 0x1f5bb8 in mpy_float64 ()
#1 0xa6a3c in lxntrn ()
#2 0x85ed8 in upihmi ()
#3 0x1f5b98 in mpy_float64 ()
#4 0x30000 in check_Errors () at /utils/home/auto/Manager.c:1253

The line 1253 is sprintf

sprintf(Error,"%d in %d seconds.",Msg, interval );

Thanx


4 REPLIES 4

Re: Program is hanging intermittently

odd that it hangs in a function relating to floating point... Its a long time since I programmed in C, but aren't %d conversion characters for displaying integers rather than floating points? what type of variables are Msg and interval?

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Sup
Advisor

Re: Program is hanging intermittently

Hi,

Msg and interval are integer variables.

Thanx
A. Clay Stephenson
Acclaimed Contributor

Re: Program is hanging intermittently

I would check the type and length of the variable 'Error'. Another possible cause, is that error is *char and points to a variable that has gone out of scope or was not allocated with enough space. If you have a memory overwrite problem, the actual cause could be far from this line of code and all you are seeing is an artifact of the actual bad code.
If it ain't broke, I can fix that.
Deepak Extross
Honored Contributor

Re: Program is hanging intermittently

Hi,
1. Try printing out the value of strlen(Error), make sure it is at least 100 bytes.
2. Do a memset(Error, '\0' sizeof(Error)) before your sprintf to initialise it.
3. Does sprintf(Error, "%s", "This is a fixed string") work? If it does, then its probably an issue with the integer variables. In that case, try printing them one at a time to find out which is causing the problem.