This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] Making an Error site’s file name available to an Error raise hook

When my program raises an error, I don't see the name of the file which raised the error. How can I get the file name to be printed in the error message?

  • By default, SYS/BIOS modules are built such that the file name of the site where an Error is raised is not accessible to a registered Error raise hook (xdc_runtime_Error.raiseHook). In other words, by default, the modules are built such that xdc_FILE is NULL, so the file names are optimized out. [See the description of xdc_FILE in “Controlling File Name Strings” here: http://rtsc.eclipseprojects.io/docs-tip/Integrating_RTSC_Modules]. To have the file name accessible to the Error raise hook, the SYS/BIOS libraries need to be rebuilt with xdc_FILE=__FILE__.

    The easiest way to do this with SYS/BIOS v6.32 or later is to use the Custom build type (i.e., BIOS.LibType_Custom, as described under “Compiler and Linker Optimization” in Bios_User_Guide.pdf), and specify xdc_FILE via a compiler option. You can do this by adding statements like the following to your application configuration script:

    BIOS.libType = BIOS.LibType_Custom;
    BIOS.customCCOpts += " -Dxdc_FILE=__FILE__ ";

    For other (non BIOS.LibType_Custom) application builds, the alternative is to rebuild the SYS/BIOS libraries as described in Appendix B of Bios_User_Guide.pdf, with the additional specification of xdc_FILE=__FILE__.