cout causing shell respawn. - VxWorks

This is a discussion on cout causing shell respawn. - VxWorks ; I am facing a problem where the shell respawns when a function containing a "cout" statement in invoked (The routine contains only "cout" calls as shown below). As specified in the "VxWorks Kernel Programming Guide 6.2", I have included the ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: cout causing shell respawn.

  1. cout causing shell respawn.


    I am facing a problem where the shell respawns when a function
    containing a "cout" statement in invoked (The routine contains only
    "cout" calls as shown below).

    As specified in the "VxWorks Kernel Programming Guide 6.2", I have
    included the components INCLUDE_CTORS_DTORS, INCLUDE_CPLUS,
    INCLUDE_CPLUS_LANG, INCLUDE_CPLUS_IOSTREAMS, INCLUDE_CPLUS_DEMANGLER
    (checked and confirmed that it is present in the BSP).

    Also, the namespace changes suggested for VxWorks6.2 in the above
    document is being taken care of. Following is the code snippet being
    used.

    #include
    int needHelp()
    {
    std::cout << "Version - which version of software is running" <<
    std::endl;
    std::cout << "Status - status of the board" << std::endl;
    std::cout << "Show - one line summmary" << std::endl;
    }

    On loading the object file and invoking the "needHelp" routine at the
    VxWorks prompt, the shell respawns.

    I did try the other 2 correct alternative ways of using "cout" as
    specified in the section 11.6 of VxWorks Kernel Programmers Guide 6.2,
    but still see the same issue of shell respawn.

    program
    Exception current instruction address: 0x00000000
    Machine Status Register: 0x0008b030
    Condition Register: 0x20000442

    0x000d8a1c vxTaskEntry +0x5c : 0x000bb470 ()
    0x000bb470 shellTask +0x530: shellExec ()
    0x000baeb8 shellExec +0x194: 0x000b652c ()
    0x000b674c shellInterpCparse+0x12d4: shellInterpCparse ()
    0x000b622c shellInterpCparse+0xdb4: 0x000b23a0 ()
    0x000b23c8 shellInterpCInit+0x13e0: 0x000b209c ()
    0x000b20c4 shellInterpCInit+0x10dc: 0x000b1f24 ()^M
    0x000b1fe0 shellInterpCInit+0xff8: shellInternalFunctionCall ()
    0x000ad9cc shellInternalFunctionCall+0xa4 : needHelp() ()
    0x19c01068 needHelp() +0x68 : 0x022de1ac ()

    Shell task 'tShell0' restarted...

    Appreciate any help.


  2. Re: cout causing shell respawn.

    Hi:

    Normally, the shell use "C" calling sequences when calling functions
    directly. If you don't have a "C" function called needHelp, then
    normally it would say unddefined symbol, but in you case it seems to be
    resolving somehow. Usually, you have a couple of choices - add extern
    "C" to the function, or do cplusDemanglerSet(0) before you load the
    object. You should then be able to see the mangled name and you can
    call that directly. Use "lkup needHelp" to see the mangled name, and
    call that from the shell. The demangled name might have some
    underscopes and it will have encodings for the debugger to use for
    passed and returned parameters. That might get it going.

    Good luck,
    LC

    You have two choices -
    Vivek wrote:
    > I am facing a problem where the shell respawns when a function
    > containing a "cout" statement in invoked (The routine contains only
    > "cout" calls as shown below).
    >
    > As specified in the "VxWorks Kernel Programming Guide 6.2", I have
    > included the components INCLUDE_CTORS_DTORS, INCLUDE_CPLUS,
    > INCLUDE_CPLUS_LANG, INCLUDE_CPLUS_IOSTREAMS, INCLUDE_CPLUS_DEMANGLER
    > (checked and confirmed that it is present in the BSP).
    >
    > Also, the namespace changes suggested for VxWorks6.2 in the above
    > document is being taken care of. Following is the code snippet being
    > used.
    >
    > #include
    > int needHelp()
    > {
    > std::cout << "Version - which version of software is running" <<
    > std::endl;
    > std::cout << "Status - status of the board" << std::endl;
    > std::cout << "Show - one line summmary" << std::endl;
    > }
    >
    > On loading the object file and invoking the "needHelp" routine at the
    > VxWorks prompt, the shell respawns.
    >
    > I did try the other 2 correct alternative ways of using "cout" as
    > specified in the section 11.6 of VxWorks Kernel Programmers Guide 6.2,
    > but still see the same issue of shell respawn.
    >
    > program
    > Exception current instruction address: 0x00000000
    > Machine Status Register: 0x0008b030
    > Condition Register: 0x20000442
    >
    > 0x000d8a1c vxTaskEntry +0x5c : 0x000bb470 ()
    > 0x000bb470 shellTask +0x530: shellExec ()
    > 0x000baeb8 shellExec +0x194: 0x000b652c ()
    > 0x000b674c shellInterpCparse+0x12d4: shellInterpCparse ()
    > 0x000b622c shellInterpCparse+0xdb4: 0x000b23a0 ()
    > 0x000b23c8 shellInterpCInit+0x13e0: 0x000b209c ()
    > 0x000b20c4 shellInterpCInit+0x10dc: 0x000b1f24 ()^M
    > 0x000b1fe0 shellInterpCInit+0xff8: shellInternalFunctionCall ()
    > 0x000ad9cc shellInternalFunctionCall+0xa4 : needHelp() ()
    > 0x19c01068 needHelp() +0x68 : 0x022de1ac ()
    >
    > Shell task 'tShell0' restarted...
    >
    > Appreciate any help.



  3. Re: cout causing shell respawn.


    Thank you Larry for your response.

    I did try both the options and unfortunately the problem is still seen.
    Trying "lkup needHelp" did show the routine in the symbol table and
    attempt to invoke this routine using it's demangled name still results
    in the same issue.

    I see this problem of cout not working only in Vxworks6.2. The same
    works fine on vxworks5.5

    According to vxworks 6.2 kernel programming guide, the components
    INCLUDE_CPLUS_STRING, INCLUDE_CPLUS_STRING_IO also have
    to be included. But the vxworks 6.2 Migration guide indicates these
    components as deprecated and being removed. Any inputs on this ?

    Regards,
    Vivek


    LarryC wrote:
    > Hi:
    >
    > Normally, the shell use "C" calling sequences when calling functions
    > directly. If you don't have a "C" function called needHelp, then
    > normally it would say unddefined symbol, but in you case it seems to be
    > resolving somehow. Usually, you have a couple of choices - add extern
    > "C" to the function, or do cplusDemanglerSet(0) before you load the
    > object. You should then be able to see the mangled name and you can
    > call that directly. Use "lkup needHelp" to see the mangled name, and
    > call that from the shell. The demangled name might have some
    > underscopes and it will have encodings for the debugger to use for
    > passed and returned parameters. That might get it going.
    >
    > Good luck,
    > LC
    >
    > You have two choices -
    > Vivek wrote:
    > > I am facing a problem where the shell respawns when a function
    > > containing a "cout" statement in invoked (The routine contains only
    > > "cout" calls as shown below).
    > >
    > > As specified in the "VxWorks Kernel Programming Guide 6.2", I have
    > > included the components INCLUDE_CTORS_DTORS, INCLUDE_CPLUS,
    > > INCLUDE_CPLUS_LANG, INCLUDE_CPLUS_IOSTREAMS, INCLUDE_CPLUS_DEMANGLER
    > > (checked and confirmed that it is present in the BSP).
    > >
    > > Also, the namespace changes suggested for VxWorks6.2 in the above
    > > document is being taken care of. Following is the code snippet being
    > > used.
    > >
    > > #include
    > > int needHelp()
    > > {
    > > std::cout << "Version - which version of software is running" <<
    > > std::endl;
    > > std::cout << "Status - status of the board" << std::endl;
    > > std::cout << "Show - one line summmary" << std::endl;
    > > }
    > >
    > > On loading the object file and invoking the "needHelp" routine at the
    > > VxWorks prompt, the shell respawns.
    > >
    > > I did try the other 2 correct alternative ways of using "cout" as
    > > specified in the section 11.6 of VxWorks Kernel Programmers Guide 6.2,
    > > but still see the same issue of shell respawn.
    > >
    > > program
    > > Exception current instruction address: 0x00000000
    > > Machine Status Register: 0x0008b030
    > > Condition Register: 0x20000442
    > >
    > > 0x000d8a1c vxTaskEntry +0x5c : 0x000bb470 ()
    > > 0x000bb470 shellTask +0x530: shellExec ()
    > > 0x000baeb8 shellExec +0x194: 0x000b652c ()
    > > 0x000b674c shellInterpCparse+0x12d4: shellInterpCparse ()
    > > 0x000b622c shellInterpCparse+0xdb4: 0x000b23a0 ()
    > > 0x000b23c8 shellInterpCInit+0x13e0: 0x000b209c ()
    > > 0x000b20c4 shellInterpCInit+0x10dc: 0x000b1f24 ()^M
    > > 0x000b1fe0 shellInterpCInit+0xff8: shellInternalFunctionCall ()
    > > 0x000ad9cc shellInternalFunctionCall+0xa4 : needHelp() ()
    > > 0x19c01068 needHelp() +0x68 : 0x022de1ac ()
    > >
    > > Shell task 'tShell0' restarted...
    > >
    > > Appreciate any help.



  4. Re: cout causing shell respawn.

    Vivek:

    I don't use 6.2, but did you include "C++" support in your kernel?
    >From the #includes you talked about, it looked like you were manually

    making a kernel by modifying the config.h or what it throught the GUI
    for Workbench?

    >From the exception dump, you are down at location 0, which usually

    implies you are running code that had some sort of a link problem.

    How are you loading the code? Does it say anything is unresolved when
    it loads?

    Good luck,
    LC

    Vivek wrote:
    > Thank you Larry for your response.
    >
    > I did try both the options and unfortunately the problem is still seen.
    > Trying "lkup needHelp" did show the routine in the symbol table and
    > attempt to invoke this routine using it's demangled name still results
    > in the same issue.
    >
    > I see this problem of cout not working only in Vxworks6.2. The same
    > works fine on vxworks5.5
    >
    > According to vxworks 6.2 kernel programming guide, the components
    > INCLUDE_CPLUS_STRING, INCLUDE_CPLUS_STRING_IO also have
    > to be included. But the vxworks 6.2 Migration guide indicates these
    > components as deprecated and being removed. Any inputs on this ?
    >
    > Regards,
    > Vivek
    >
    >
    > LarryC wrote:
    > > Hi:
    > >
    > > Normally, the shell use "C" calling sequences when calling functions
    > > directly. If you don't have a "C" function called needHelp, then
    > > normally it would say unddefined symbol, but in you case it seems to be
    > > resolving somehow. Usually, you have a couple of choices - add extern
    > > "C" to the function, or do cplusDemanglerSet(0) before you load the
    > > object. You should then be able to see the mangled name and you can
    > > call that directly. Use "lkup needHelp" to see the mangled name, and
    > > call that from the shell. The demangled name might have some
    > > underscopes and it will have encodings for the debugger to use for
    > > passed and returned parameters. That might get it going.
    > >
    > > Good luck,
    > > LC
    > >
    > > You have two choices -
    > > Vivek wrote:
    > > > I am facing a problem where the shell respawns when a function
    > > > containing a "cout" statement in invoked (The routine contains only
    > > > "cout" calls as shown below).
    > > >
    > > > As specified in the "VxWorks Kernel Programming Guide 6.2", I have
    > > > included the components INCLUDE_CTORS_DTORS, INCLUDE_CPLUS,
    > > > INCLUDE_CPLUS_LANG, INCLUDE_CPLUS_IOSTREAMS, INCLUDE_CPLUS_DEMANGLER
    > > > (checked and confirmed that it is present in the BSP).
    > > >
    > > > Also, the namespace changes suggested for VxWorks6.2 in the above
    > > > document is being taken care of. Following is the code snippet being
    > > > used.
    > > >
    > > > #include
    > > > int needHelp()
    > > > {
    > > > std::cout << "Version - which version of software is running" <<
    > > > std::endl;
    > > > std::cout << "Status - status of the board" << std::endl;
    > > > std::cout << "Show - one line summmary" << std::endl;
    > > > }
    > > >
    > > > On loading the object file and invoking the "needHelp" routine at the
    > > > VxWorks prompt, the shell respawns.
    > > >
    > > > I did try the other 2 correct alternative ways of using "cout" as
    > > > specified in the section 11.6 of VxWorks Kernel Programmers Guide 6.2,
    > > > but still see the same issue of shell respawn.
    > > >
    > > > program
    > > > Exception current instruction address: 0x00000000
    > > > Machine Status Register: 0x0008b030
    > > > Condition Register: 0x20000442
    > > >
    > > > 0x000d8a1c vxTaskEntry +0x5c : 0x000bb470 ()
    > > > 0x000bb470 shellTask +0x530: shellExec ()
    > > > 0x000baeb8 shellExec +0x194: 0x000b652c ()
    > > > 0x000b674c shellInterpCparse+0x12d4: shellInterpCparse ()
    > > > 0x000b622c shellInterpCparse+0xdb4: 0x000b23a0 ()
    > > > 0x000b23c8 shellInterpCInit+0x13e0: 0x000b209c ()
    > > > 0x000b20c4 shellInterpCInit+0x10dc: 0x000b1f24 ()^M
    > > > 0x000b1fe0 shellInterpCInit+0xff8: shellInternalFunctionCall ()
    > > > 0x000ad9cc shellInternalFunctionCall+0xa4 : needHelp() ()
    > > > 0x19c01068 needHelp() +0x68 : 0x022de1ac ()
    > > >
    > > > Shell task 'tShell0' restarted...
    > > >
    > > > Appreciate any help.



  5. Re: cout causing shell respawn.


    Larry,

    > I don't use 6.2, but did you include "C++" support in your kernel?
    > >From the #includes you talked about, it looked like you were manually

    > making a kernel by modifying the config.h or what it throught the GUI
    > for Workbench?


    Yes, I have included C++ support in the kernel by defining the
    INCLUDE_CPLUS macro in the config.h. In addition to this, the
    components
    I mentioned in my first message is also being defined in the config.h.
    I am building the kernel by issuing make from the command line
    (NOT from GUI or workbench).

    > >From the exception dump, you are down at location 0, which usually

    > implies you are running code that had some sort of a link problem.
    >
    > How are you loading the code? Does it say anything is unresolved when
    > it loads?


    I am loading the object file using
    ld(1,0,/tmp/needHelp.o)
    at the vxworks prompt.

    No, I do not get any unreserved symbols during loading.

    Vivek


    LarryC wrote:
    > Vivek:
    >
    > I don't use 6.2, but did you include "C++" support in your kernel?
    > >From the #includes you talked about, it looked like you were manually

    > making a kernel by modifying the config.h or what it throught the GUI
    > for Workbench?
    >
    > >From the exception dump, you are down at location 0, which usually

    > implies you are running code that had some sort of a link problem.
    >
    > How are you loading the code? Does it say anything is unresolved when
    > it loads?
    >
    > Good luck,
    > LC
    >
    > Vivek wrote:
    > > Thank you Larry for your response.
    > >
    > > I did try both the options and unfortunately the problem is still seen.
    > > Trying "lkup needHelp" did show the routine in the symbol table and
    > > attempt to invoke this routine using it's demangled name still results
    > > in the same issue.
    > >
    > > I see this problem of cout not working only in Vxworks6.2. The same
    > > works fine on vxworks5.5
    > >
    > > According to vxworks 6.2 kernel programming guide, the components
    > > INCLUDE_CPLUS_STRING, INCLUDE_CPLUS_STRING_IO also have
    > > to be included. But the vxworks 6.2 Migration guide indicates these
    > > components as deprecated and being removed. Any inputs on this ?
    > >
    > > Regards,
    > > Vivek
    > >
    > >
    > > LarryC wrote:
    > > > Hi:
    > > >
    > > > Normally, the shell use "C" calling sequences when calling functions
    > > > directly. If you don't have a "C" function called needHelp, then
    > > > normally it would say unddefined symbol, but in you case it seems to be
    > > > resolving somehow. Usually, you have a couple of choices - add extern
    > > > "C" to the function, or do cplusDemanglerSet(0) before you load the
    > > > object. You should then be able to see the mangled name and you can
    > > > call that directly. Use "lkup needHelp" to see the mangled name, and
    > > > call that from the shell. The demangled name might have some
    > > > underscopes and it will have encodings for the debugger to use for
    > > > passed and returned parameters. That might get it going.
    > > >
    > > > Good luck,
    > > > LC
    > > >
    > > > You have two choices -
    > > > Vivek wrote:
    > > > > I am facing a problem where the shell respawns when a function
    > > > > containing a "cout" statement in invoked (The routine contains only
    > > > > "cout" calls as shown below).
    > > > >
    > > > > As specified in the "VxWorks Kernel Programming Guide 6.2", I have
    > > > > included the components INCLUDE_CTORS_DTORS, INCLUDE_CPLUS,
    > > > > INCLUDE_CPLUS_LANG, INCLUDE_CPLUS_IOSTREAMS, INCLUDE_CPLUS_DEMANGLER
    > > > > (checked and confirmed that it is present in the BSP).
    > > > >
    > > > > Also, the namespace changes suggested for VxWorks6.2 in the above
    > > > > document is being taken care of. Following is the code snippet being
    > > > > used.
    > > > >
    > > > > #include
    > > > > int needHelp()
    > > > > {
    > > > > std::cout << "Version - which version of software is running" <<
    > > > > std::endl;
    > > > > std::cout << "Status - status of the board" << std::endl;
    > > > > std::cout << "Show - one line summmary" << std::endl;
    > > > > }
    > > > >
    > > > > On loading the object file and invoking the "needHelp" routine at the
    > > > > VxWorks prompt, the shell respawns.
    > > > >
    > > > > I did try the other 2 correct alternative ways of using "cout" as
    > > > > specified in the section 11.6 of VxWorks Kernel Programmers Guide 6.2,
    > > > > but still see the same issue of shell respawn.
    > > > >
    > > > > program
    > > > > Exception current instruction address: 0x00000000
    > > > > Machine Status Register: 0x0008b030
    > > > > Condition Register: 0x20000442
    > > > >
    > > > > 0x000d8a1c vxTaskEntry +0x5c : 0x000bb470 ()
    > > > > 0x000bb470 shellTask +0x530: shellExec ()
    > > > > 0x000baeb8 shellExec +0x194: 0x000b652c ()
    > > > > 0x000b674c shellInterpCparse+0x12d4: shellInterpCparse ()
    > > > > 0x000b622c shellInterpCparse+0xdb4: 0x000b23a0 ()
    > > > > 0x000b23c8 shellInterpCInit+0x13e0: 0x000b209c ()
    > > > > 0x000b20c4 shellInterpCInit+0x10dc: 0x000b1f24 ()^M
    > > > > 0x000b1fe0 shellInterpCInit+0xff8: shellInternalFunctionCall ()
    > > > > 0x000ad9cc shellInternalFunctionCall+0xa4 : needHelp() ()
    > > > > 0x19c01068 needHelp() +0x68 : 0x022de1ac ()
    > > > >
    > > > > Shell task 'tShell0' restarted...
    > > > >
    > > > > Appreciate any help.



+ Reply to Thread