Debug tasks spawned by taskSpawn - VxWorks

This is a discussion on Debug tasks spawned by taskSpawn - VxWorks ; Hi, Can anybody give me a hint on how to debug a function spawned by taskSpawn on Workbench? I suspect one of the global variables get constantly overwritten somewhere. So I need to find out what causes it. Here is ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Debug tasks spawned by taskSpawn

  1. Debug tasks spawned by taskSpawn

    Hi,

    Can anybody give me a hint on how to debug a function spawned by
    taskSpawn on Workbench? I suspect one of the global variables get
    constantly overwritten somewhere. So I need to find out what causes it.

    Here is the project structure:


    // main.c
    STATUS main()
    {
    taskSpawn(........(FUNCPTR)myFunc,......);
    taskExit(0);
    return(OK);
    }


    //ertmain.c
    int myFunc()
    {
    taskSpawn(........(FUNCPTR)hello,...);
    taskSpawn(........(FUNCPTR)foo,.....);
    .....some other codes;

    return(OK);
    }

    //yourfile.c
    void hello()
    {
    some codes;
    }

    //myfile.c
    void foo()
    {
    a[0] = b[0];
    a[1] = b[1];
    .....
    some other codes;
    }

    I built this project as a Downloadable Kernel Module (DKM) project in
    Wind River Workbench 2.4 with vxWorks 6.2. The project has no built
    error and runs but with unpredictable results probably caused by data
    overflow.

    When I try to debug this project, how can I debug the function foo()
    with all other process running prior to my foo()?

    The function foo() is taskSpawned once and executed at a periodic rate.
    I need to see who overwrite the global variables inside foo() at the
    periodic rate. How to do so?

    If I set the entry point to be foo() for the debugger, I have control
    stepping into or over, but the function hello() doesn't get spawned.
    Besides, the function foo() doesn't run periodically if I click resume,
    and it never hits the breakpoint again.

    If i set the entry point to be main() with "break on entry" checked, it
    breaks at function main and can be controlled using step int, over, or
    return. But I cannot step into myFunc() nor even foo().

    If I set the entry point to be main() with "break on entry" unchecked,
    I cannot manage anything but seeing taskExit.

    If I set a breakpoint(line breakpoint or hardware breakpoint) inside
    foo(), and the entry point main() for the debugger, the task does break
    at breakpoint, but I cannot hit Step In, Step Over, or Step Return
    button. They are all grey out. I have no control at all. Besides the
    Watch window shows nothing for the variable a[] that I added to for
    watching.


    I read the Workbench user's guide and debugging manual, they didn't
    mention any. Help please!
    Regards,

    Ray


  2. Re: Debug tasks spawned by taskSpawn

    Hi:
    I dont do Workbench/vxWorks 6, but in regular vxWorks, I would try
    running two sessions of the debugger via two Tornado sessions onto the
    same target server, and attach to the two spawned tasks. You could also
    use the shell breakpoint function to stop on the beginning of one of
    your functions, wbich should get you into the debugger already attached
    to that task.

    Good luck,
    lc
    Ray wrote:
    > Hi,
    >
    > Can anybody give me a hint on how to debug a function spawned by
    > taskSpawn on Workbench? I suspect one of the global variables get
    > constantly overwritten somewhere. So I need to find out what causes it.
    >
    > Here is the project structure:
    >
    >
    > // main.c
    > STATUS main()
    > {
    > taskSpawn(........(FUNCPTR)myFunc,......);
    > taskExit(0);
    > return(OK);
    > }
    >
    >
    > //ertmain.c
    > int myFunc()
    > {
    > taskSpawn(........(FUNCPTR)hello,...);
    > taskSpawn(........(FUNCPTR)foo,.....);
    > .....some other codes;
    >
    > return(OK);
    > }
    >
    > //yourfile.c
    > void hello()
    > {
    > some codes;
    > }
    >
    > //myfile.c
    > void foo()
    > {
    > a[0] = b[0];
    > a[1] = b[1];
    > .....
    > some other codes;
    > }
    >
    > I built this project as a Downloadable Kernel Module (DKM) project in
    > Wind River Workbench 2.4 with vxWorks 6.2. The project has no built
    > error and runs but with unpredictable results probably caused by data
    > overflow.
    >
    > When I try to debug this project, how can I debug the function foo()
    > with all other process running prior to my foo()?
    >
    > The function foo() is taskSpawned once and executed at a periodic rate.
    > I need to see who overwrite the global variables inside foo() at the
    > periodic rate. How to do so?
    >
    > If I set the entry point to be foo() for the debugger, I have control
    > stepping into or over, but the function hello() doesn't get spawned.
    > Besides, the function foo() doesn't run periodically if I click resume,
    > and it never hits the breakpoint again.
    >
    > If i set the entry point to be main() with "break on entry" checked, it
    > breaks at function main and can be controlled using step int, over, or
    > return. But I cannot step into myFunc() nor even foo().
    >
    > If I set the entry point to be main() with "break on entry" unchecked,
    > I cannot manage anything but seeing taskExit.
    >
    > If I set a breakpoint(line breakpoint or hardware breakpoint) inside
    > foo(), and the entry point main() for the debugger, the task does break
    > at breakpoint, but I cannot hit Step In, Step Over, or Step Return
    > button. They are all grey out. I have no control at all. Besides the
    > Watch window shows nothing for the variable a[] that I added to for
    > watching.
    >
    >
    > I read the Workbench user's guide and debugging manual, they didn't
    > mention any. Help please!
    > Regards,
    >
    > Ray



+ Reply to Thread