PM00655: Rhapsody - Char* as event param prints junk values on console
Closed as Permanent restriction.
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
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.
A possible solution might be to allocate the memory yourself and send it to the constructor: use char *carId = new char; instead of: char carId; You can add a destructor to the constructor in order to release this memory.
Reported component name
Reported component ID
Last modified date
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following: