Core file generated sometimes in my C application on AIX 5.2 - Aix

This is a discussion on Core file generated sometimes in my C application on AIX 5.2 - Aix ; Hi, I have developed a software in C on IBM AIX 5.2 Machine. It work fines but after few days or months it crashes. I have checked it using dbx but I am unable to sort out the place where ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Core file generated sometimes in my C application on AIX 5.2

  1. Core file generated sometimes in my C application on AIX 5.2

    Hi,

    I have developed a software in C on IBM AIX 5.2 Machine. It work fines
    but after few days or months it crashes. I have checked it using dbx
    but I am unable to sort out the place where the problem occurs.

    The trace of dbx is given below:
    ----------------------------------------------------------------------------------------------------------------------------------------
    [sp:/home/sp/control]dbx ctrlmain core-1217590137
    Type 'help' for help.
    [using memory image in core-1217590137]
    reading symbolic information ...warning: controldatabase.c is newer
    than ctrlmain


    Segmentation fault in strlen at 0xd01ec080 ($t1)
    0xd01ec080 (strlen+0x80) 88ac0000 lbz r5,0x0(r12)

    (dbx) where
    strlen() at 0xd01ec080
    _doprnt(??, ??, ??) at 0xd0205490
    sprintf(0x2ff209f8, 0x20763ab8, 0x83, 0x209abf76, 0x209ac28a,
    0x57505551, 0x65640000, 0x8080) at 0xd0203a4c
    SendCommand(0x20012310, 0x2ff21d84, 0x2ff209f8, 0x20012320) at
    0xd34efd10
    Manager(0x2ff22720, 0x20014908), line 308 in "ctrlManager.c"
    CPManager(), line 131 in "ctrlCPManager.c"
    FetchQueue(v = warning: Unable to access address 0x2ff247d8 from core
    0xffffffff, 0x2ff22c60), line 274 in "ctrlmain.c"

    (dbx) x
    $r0:0x00000024 $stkp:0x2ff1cd10 $toc:0xf0f3e35c
    $r3:0x57505551
    $r4:0x00000003 $r5:0x00000000 $r6:0x00000000
    $r7:0xd0366a38
    $r8:0xd036870c $r9:0x55423a25 $r10:0xd0367150
    $r11:0x7f7f7f7f
    $r12:0x57505551 $r13:0x2ff1d500 $r14:0x57505551
    $r15:0x2ff22c60
    $r16:0x2ff22c6c $r17:0x00000001 $r18:0xffffffff
    $r19:0x00000000
    $r20:0x00000000 $r21:0x00000073 $r22:0x00000030
    $r23:0x47ae147a
    $r24:0x00000020 $r25:0x51eb851f $r26:0xd0366b00
    $r27:0x20763b05
    $r28:0x2ff20a4a $r29:0x7fffffad $r30:0x00000052
    $r31:0x2ff1d4a0
    $iar:0xd01ec080 $msr:0x0000d0b2 $cr:0x44244444 $link:
    0xd0205494
    $ctr:0x00000003 $xer:0x60000000 $mq:0xdeadbeef
    Condition status = 0:g 1:g 2:e 3:g 4:g 5:g 6:g 7:g
    [unset $noflregs to view floating point registers]
    in strlen at 0xd01ec080 ($t1)
    0xd01ec080 (strlen+0x80) 88ac0000 lbz r5,0x0(r12)
    (dbx) q
    ----------------------------------------------------------------------------------------------------------------------------------------

    Kindly give me a helping hand.

    Regards,

    Ahmad Jalil Qarshi

  2. Re: Core file generated sometimes in my C application on AIX 5.2

    Ahmad Jalil Qarshi wrote:
    > Hi,
    >
    > I have developed a software in C on IBM AIX 5.2 Machine. It work fines
    > but after few days or months it crashes. I have checked it using dbx
    > but I am unable to sort out the place where the problem occurs.
    >


    >
    > Segmentation fault in strlen at 0xd01ec080 ($t1)
    > 0xd01ec080 (strlen+0x80) 88ac0000 lbz r5,0x0(r12)
    >
    > (dbx) where
    > strlen() at 0xd01ec080
    > _doprnt(??, ??, ??) at 0xd0205490
    > sprintf(0x2ff209f8, 0x20763ab8, 0x83, 0x209abf76, 0x209ac28a,
    > 0x57505551, 0x65640000, 0x8080) at 0xd0203a4c
    > SendCommand(0x20012310, 0x2ff21d84, 0x2ff209f8, 0x20012320) at
    > 0xd34efd10
    > Manager(0x2ff22720, 0x20014908), line 308 in "ctrlManager.c"
    > CPManager(), line 131 in "ctrlCPManager.c"
    > FetchQueue(v = warning: Unable to access address 0x2ff247d8 from core
    > 0xffffffff, 0x2ff22c60), line 274 in "ctrlmain.c"
    >
    > (dbx) x


    > $r12:0x57505551 $r13:0x2ff1d500 $r14:0x57505551 $r15:0x2ff22c60



    R12 has an address which isn't valid. That value was passed into
    sprintf from SendCommand -- I assume that it is supposed to be a pointer
    to a character string. SendCommand is where you need to look: where
    did SendCommand get that value from? That info will hopefully lead you
    to where the origins of your problem lie.

    Jim Lahue

  3. Re: Core file generated sometimes in my C application on AIX 5.2

    Jim Lahue writes:

    > Ahmad Jalil Qarshi wrote:

    ....
    >> $r12:0x57505551 $r13:0x2ff1d500 $r14:0x57505551 $r15:0x2ff22c60

    ....
    > R12 has an address which isn't valid.


    Not only is it not valid, but it also contains ASCII characters
    "WPUQ". Most often this means that someone "stepped on" a pointer
    value elsewhere, corrupting it.

    Here is an example which crashes exactly the same way (when
    compiled in 32-bit mode):

    int fn(const char *s)
    {
    struct { char buf[4]; char *p; } ss;
    ss.p = ss.buf;
    strcpy(ss.buf, s);
    return strlen(ss.p);
    }

    int main()
    {
    return fn("abcdWPUQ");
    }

    > That value was passed into
    > sprintf from SendCommand -- I assume that it is supposed to be a
    > pointer to a character string. SendCommand is where you need to
    > look: where did SendCommand get that value from? That info will
    > hopefully lead you to where the origins of your problem lie.


    Or not: the clobbering of pointer may have happened quite a long
    way away from the crash point.

    Automated checking tools, such as Insure++, Purify, ZeroFault or
    Coverity may be able to find this kind of corruption.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

+ Reply to Thread