Bfill in memset - VxWorks

This is a discussion on Bfill in memset - VxWorks ; Hi, I find that my program breaks at 'bfill' in memset . How to avoid this ? Is there any issue in 'bfill' in Vxworks ? snapshot for your reference : 004a39d4 : 4a39d4: 94 21 ff e8 stwu r1,-24(r1) ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Bfill in memset

  1. Bfill in memset

    Hi,

    I find that my program breaks at 'bfill' in memset . How to avoid
    this ?
    Is there any issue in 'bfill' in Vxworks ?

    snapshot for your reference :

    004a39d4 :
    4a39d4: 94 21 ff e8 stwu r1,-24(r1)
    4a39d8: 7c 08 02 a6 mflr r0
    4a39dc: 93 a1 00 0c stw r29,12(r1)
    4a39e0: 93 c1 00 10 stw r30,16(r1)
    4a39e4: 93 e1 00 14 stw r31,20(r1)
    4a39e8: 90 01 00 1c stw r0,28(r1)
    4a39ec: 7c 7d 1b 78 mr r29,r3
    4a39f0: 7c 80 23 78 mr r0,r4
    4a39f4: 7c a4 2b 78 mr r4,r5
    4a39f8: 7c 05 03 78 mr r5,r0
    4a39fc: 4b fb b6 e5 bl 45f0e0 =========> Breaks here :
    (
    4a3a00: 7f a3 eb 78 mr r3,r29
    4a3a04: 80 01 00 1c lwz r0,28(r1)
    4a3a08: 7c 08 03 a6 mtlr r0
    4a3a0c: 83 a1 00 0c lwz r29,12(r1)
    4a3a10: 83 c1 00 10 lwz r30,16(r1)
    4a3a14: 83 e1 00 14 lwz r31,20(r1)
    4a3a18: 38 21 00 18 addi r1,r1,24
    4a3a1c: 4e 80 00 20 blr


    Thx in advans,
    Karthik Balaguru


  2. Re: Bfill in memset

    On Aug 9, 8:08 am, karthikbalaguru
    wrote:
    > Hi,
    >
    > I find that my program breaks at 'bfill' in memset . How to avoid
    > this ?
    > Is there any issue in 'bfill' in Vxworks ?
    >
    > snapshot for your reference :
    >
    > 004a39d4 :
    > 4a39d4: 94 21 ff e8 stwu r1,-24(r1)
    > 4a39d8: 7c 08 02 a6 mflr r0
    > 4a39dc: 93 a1 00 0c stw r29,12(r1)
    > 4a39e0: 93 c1 00 10 stw r30,16(r1)
    > 4a39e4: 93 e1 00 14 stw r31,20(r1)
    > 4a39e8: 90 01 00 1c stw r0,28(r1)
    > 4a39ec: 7c 7d 1b 78 mr r29,r3
    > 4a39f0: 7c 80 23 78 mr r0,r4
    > 4a39f4: 7c a4 2b 78 mr r4,r5
    > 4a39f8: 7c 05 03 78 mr r5,r0
    > 4a39fc: 4b fb b6 e5 bl 45f0e0 =========> Breaks here :
    > (
    > 4a3a00: 7f a3 eb 78 mr r3,r29
    > 4a3a04: 80 01 00 1c lwz r0,28(r1)
    > 4a3a08: 7c 08 03 a6 mtlr r0
    > 4a3a0c: 83 a1 00 0c lwz r29,12(r1)
    > 4a3a10: 83 c1 00 10 lwz r30,16(r1)
    > 4a3a14: 83 e1 00 14 lwz r31,20(r1)
    > 4a3a18: 38 21 00 18 addi r1,r1,24
    > 4a3a1c: 4e 80 00 20 blr
    >
    > Thx in advans,
    > Karthik Balaguru


    Yep, bfill will allow you to pass invalid pointers to it and crash or
    hang the machine.
    Did you try stepping into bfill, or did you just try stepping over and
    never return?

    HTH,
    GV


  3. Re: Bfill in memset

    On Aug 9, 11:57 pm, gvarndell wrote:
    > On Aug 9, 8:08 am, karthikbalaguru
    > wrote:
    >
    >
    >
    >
    >
    > > Hi,

    >
    > > I find that my program breaks at 'bfill' in memset . How to avoid
    > > this ?
    > > Is there any issue in 'bfill' in Vxworks ?

    >
    > > snapshot for your reference :

    >
    > > 004a39d4 :
    > > 4a39d4: 94 21 ff e8 stwu r1,-24(r1)
    > > 4a39d8: 7c 08 02 a6 mflr r0
    > > 4a39dc: 93 a1 00 0c stw r29,12(r1)
    > > 4a39e0: 93 c1 00 10 stw r30,16(r1)
    > > 4a39e4: 93 e1 00 14 stw r31,20(r1)
    > > 4a39e8: 90 01 00 1c stw r0,28(r1)
    > > 4a39ec: 7c 7d 1b 78 mr r29,r3
    > > 4a39f0: 7c 80 23 78 mr r0,r4
    > > 4a39f4: 7c a4 2b 78 mr r4,r5
    > > 4a39f8: 7c 05 03 78 mr r5,r0
    > > 4a39fc: 4b fb b6 e5 bl 45f0e0 =========> Breaks here :
    > > (
    > > 4a3a00: 7f a3 eb 78 mr r3,r29
    > > 4a3a04: 80 01 00 1c lwz r0,28(r1)
    > > 4a3a08: 7c 08 03 a6 mtlr r0
    > > 4a3a0c: 83 a1 00 0c lwz r29,12(r1)
    > > 4a3a10: 83 c1 00 10 lwz r30,16(r1)
    > > 4a3a14: 83 e1 00 14 lwz r31,20(r1)
    > > 4a3a18: 38 21 00 18 addi r1,r1,24
    > > 4a3a1c: 4e 80 00 20 blr

    >
    > > Thx in advans,
    > > Karthik Balaguru

    >
    > Yep, bfill will allow you to pass invalid pointers to it and crash or
    > hang the machine.
    > Did you try stepping into bfill, or did you just try stepping over and
    > never return?
    >
    > HTH,
    > GV- Hide quoted text -
    >
    > - Show quoted text -


    Is there any fix for bfill.
    Any fix available to avoid the invalid parameters entering it or
    intimating with a compilation/runtime error message ?

    I did not do step-debugging. I searched for the Programcounter at
    which my application hangs in the Vxworks MAP file.
    I found that it was pointing to bfill in memset. (Refer my earlier
    mail that has the necessary snapshot for your reference).

    Thx in advans,
    Karthik Balaguru



  4. Re: Bfill in memset

    On Aug 10, 11:19 am, karthikbalaguru
    wrote:
    > On Aug 9, 11:57 pm, gvarndell wrote:
    >
    >
    >
    > > On Aug 9, 8:08 am, karthikbalaguru
    > > wrote:

    >
    > > > Hi,

    >
    > > > I find that my program breaks at 'bfill' in memset . How to avoid
    > > > this ?
    > > > Is there any issue in 'bfill' in Vxworks ?

    >
    > > > snapshot for your reference :

    >
    > > > 004a39d4 :
    > > > 4a39d4: 94 21 ff e8 stwu r1,-24(r1)
    > > > 4a39d8: 7c 08 02 a6 mflr r0
    > > > 4a39dc: 93 a1 00 0c stw r29,12(r1)
    > > > 4a39e0: 93 c1 00 10 stw r30,16(r1)
    > > > 4a39e4: 93 e1 00 14 stw r31,20(r1)
    > > > 4a39e8: 90 01 00 1c stw r0,28(r1)
    > > > 4a39ec: 7c 7d 1b 78 mr r29,r3
    > > > 4a39f0: 7c 80 23 78 mr r0,r4
    > > > 4a39f4: 7c a4 2b 78 mr r4,r5
    > > > 4a39f8: 7c 05 03 78 mr r5,r0
    > > > 4a39fc: 4b fb b6 e5 bl 45f0e0 =========> Breaks here :
    > > > (
    > > > 4a3a00: 7f a3 eb 78 mr r3,r29
    > > > 4a3a04: 80 01 00 1c lwz r0,28(r1)
    > > > 4a3a08: 7c 08 03 a6 mtlr r0
    > > > 4a3a0c: 83 a1 00 0c lwz r29,12(r1)
    > > > 4a3a10: 83 c1 00 10 lwz r30,16(r1)
    > > > 4a3a14: 83 e1 00 14 lwz r31,20(r1)
    > > > 4a3a18: 38 21 00 18 addi r1,r1,24
    > > > 4a3a1c: 4e 80 00 20 blr

    >
    > > > Thx in advans,
    > > > Karthik Balaguru

    >
    > > Yep, bfill will allow you to pass invalid pointers to it and crash or
    > > hang the machine.
    > > Did you try stepping into bfill, or did you just try stepping over and
    > > never return?

    >
    > > HTH,
    > > GV- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > Is there any fix for bfill.
    > Any fix available to avoid the invalid parameters entering it or
    > intimating with a compilation/runtime error message ?
    >
    > I did not do step-debugging. I searched for the Programcounter at
    > which my application hangs in the Vxworks MAP file.
    > I found that it was pointing to bfill in memset. (Refer my earlier
    > mail that has the necessary snapshot for your reference).
    >
    > Thx in advans,
    > Karthik Balaguru


    It's not bfill that needs fixing, it's your application.
    1) does the target hang or crash?
    2) if crash, what exception occurs, and supply all information you
    know about the exception.
    3) if hang, how do you know what the program counter is?
    4) as always, what version of vxworks are you using?
    5) your target is obviously a PPC, which one?

    What debug tools do you have available?
    Just Tornado?
    WRICE or other JTAG based debugger?
    Do you understand your target memory map well enough to recognize an
    invalid pointer if you see one?
    If so, you could write your own memset function and check all incoming
    pointers.
    If you find a bad one, branch to some code where you've planted a
    breakpoint or force a stack trace to be printed to the terminal.

    HTH,
    GV


  5. Re: Bfill in memset

    Thx for the info provided . Looks very helpful.

    > 1) does the target hang or crash?

    It Hangs. It goes to standstill. It does not reboot.

    > 2) if crash, what exception occurs, and supply all information you
    > know about the exception.

    Ok.

    > 3) if hang, how do you know what the program counter is?

    Whenever i reboot my application once it goes in to deadlock or
    unknown state, i print the corresponding
    Program Counter values, Stack , Heap Memory details in a log
    file .
    I was able to get the Program Counter by downloading the log
    from the external Flash Memory of my device.
    After that, i searched for the same Program Counter value in
    MAP file and identified the API or place at which my
    application breaks.

    > 4) as always, what version of vxworks are you using?

    5.2

    > 5) your target is obviously a PPC, which one?

    Yes , It is PPC 862

    > What debug tools do you have available?
    > Just Tornado?

    Yes.

    > WRICE or other JTAG based debugger?

    Due to various technical reasons, Currently, I cannot JTAG .
    So, Lets forget JTAG for this activity.

    > Do you understand your target memory map well enough to recognize an
    > invalid pointer if you see one?

    Yes

    > If so, you could write your own memset function and check all incoming
    > pointers.
    > If you find a bad one, branch to some code where you've planted a
    > breakpoint or force a stack trace to be printed to the terminal.

    This sounds interesting. Maybe, I can give a try in this
    direction.
    Ok, I will start writing my own memset function and check all
    incoming pointers .

    Thx for the info provided . Looks very helpful.
    Any other ideas /links /pdfs /docs w.r.t this bfill in memset ?

    Thx in advans,
    Karthik Balaguru



+ Reply to Thread