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.

hooking into xdc asserts

Is there a way to hook into asserts (assert, Assert_IsTrue, etc) so my function is called everytime there is an assert? Someone suggested using xdc.runtime.Error, but I couldn't find info for creating a hook. I tried "raiseHook", using the following piece in xdc configuration

var errorHandler = xdc.useModule('xdc.runtime.Error');
errorHandler.raiseHook = '&M3ErrorHandler';

but that didn't work.

I appreciate any help with this.

Thanks,

AniL

  • Anil,

    I just tried this and got it to work.  The trick is that  you need to make sure to add the following lines to your .cfg file:

    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Defaults = xdc.useModule('xdc.runtime.Defaults');

    Defaults.common$.diags_ASSERT = Diags.ALWAYS_ON;
    Defaults.common$.diags_INTERNAL = Diags.ALWAYS_ON;

    Judah