IBM Support

PM00655: Rhapsody - Char* as event param prints junk values on console

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as Permanent restriction.

Error description

  • Summary:
    ---------
    Char* as event param prints junk values on console
    
    Decsription:
    -------------
    
    Using char* as an event param and trying to utilize that else
    where prints junk characters.
    
    Ex: using params->aId and params->aChar in the attached sample
    
    If I make the char* a static string, it prints:
    
    //OUT_PORT(comm)->GEN(evElevOnline(carId,true));
    OUT_PORT(comm)->GEN(evElevOnline('TEST',true));
    
    Refer: Screenshot1
    
    
    If I use a string declared on the stack, it doesn?t:
    
    sprintf(carId,'G%dC%d',grpIdx+1,carIdx+1);
    OUT_PORT(comm)->GEN(evElevOnline(carId,true));
    //OUT_PORT(comm)->GEN(evElevOnline('TEST',true));
    
    Refer: Screenshot2
    
    Should have printed ?receivedG3C5?, but printed ?receivedai:?
    
    
    
    Animation (Sequence Diagrams) displays the correct values, its
    just the console print that is affected.
    
    
    We tested with a CPP program to check the param access flow
    pattern and it prints fine.
    
    It is an issue only iwth char* in Rhapsody.
    
    
    Work Around:
    -------------
    Use sequence diagrams to see the values
    

Local fix

Problem summary

  • This is a copy constructor issue.
    When you call
    OUT_PORT(comm)-?GEN(evElevOnline(carId,false,carId,'A'));
    you actually initiate a new evElevOnline event and send to
    it a char pointer.
    Looking in the constructor of evElevOnline, you'll notice a
    simple assignment (aId = p_aId;)
    SO - when you get out of A::fxn(), this memory is being
    released, and must not be used. This is the reason you see
    garbage.
    

Problem conclusion

  • A possible solution might be to allocate the memory yourself
    and send it to the constructor:
    use
       char *carId = new char[64];
    instead of:
       char carId[64];
    
    You can add a destructor to the constructor in order to
    release this memory.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM00655

  • Reported component name

    TLOGIC RHAPSODY

  • Reported component ID

    5724V74RP

  • Reported release

    750

  • Status

    CLOSED PRS

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-11-06

  • Closed date

    2009-12-03

  • Last modified date

    2009-12-03

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

Applicable component levels

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SS7P9W","label":"Rational Rhapsody"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.5","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Document Information

Modified date:
03 December 2009