Tracing
We can generate a compilable C++ trace file of RPR for debugging. The tracing will echo all RPR commands with the memory dump of data used.
There are two ways to do a trace file:
With the RPR API.
Before any other calls of RPR, call:
// Before RPR context creation: rprContextSetParameterByKeyString(0,RPR_CONTEXT_TRACING_PATH,"C:\\folder\\"); // optional - change the tracing path rprContextSetParameterByKey1u(0,RPR_CONTEXT_TRACING_ENABLED,1); // start tracing // ... From here you can start the RPR API calls ...
Forced with an environment variable.
Add an environment variable
RPRTRACEPATH
pointing to a folder in which trace should be activated.For example, set
RPRTRACEPATH = C:\folder\
to activate the trace inside C:\folder\.Set
RPRTRACEPATH=0
or deleteRPRTRACEPATH
when you want to disable tracing.
Make sure the tracing folder path exists before starting the tracing.
In most of the cases, 6 files will be generated inside the tracing folder (depending on the trace, additional files may be generated: images, more source code):
rprTrace_data.bin
rprTrace_play1.cpp
rprTrace_player.cpp
rprTrace_player.h
rprTrace_playList.h
rprTrace_variables.h
The tracing mechanism is implemented in the file streaming way. This means that it does not matter where the program stops, the trace file will always be valid and compilable or will require a minor manual modification, like adding return 0; }
at the end of rprTrace_play1.cpp.