You copied the Doc URL to your clipboard.

Examining parameters when integer division-by-zero errors occur in C code

If you want to examine parameters and save them for postmortem debugging, you can trap __aeabi_idiv0. You can intervene in all calls to __aeabi_idiv0 by using the $Super$$ and $Sub$$ mechanism.

To examine parameters when integer division-by-zero occurs:

  1. Prefix __aeabi_idiv0() with $Super$$ to identify the original unpatched function __aeabi_idiv0().

  2. Use __aeabi_idiv0() prefixed with $Super$$ to call the original function directly.

  3. Prefix __aeabi_idiv0() with $Sub$$ to identify the new function to be called in place of the original version of __aeabi_idiv0().

  4. Use __aeabi_idiv0() prefixed with $Sub$$ to add processing before or after the original function __aeabi_idiv0().

Example

Example 36 illustrates the use of the $Super$$ and $Sub$$ mechanism to intercept __aeabi_div0.

extern void $Super$$__aeabi_idiv0(void);
/* this function is called instead of the original __aeabi_idiv0() */
void $Sub$$__aeabi_idiv0()
{
    // insert code to process a divide by zero
    ...
    // call the original __aeabi_idiv0 function
    $Super$$__aeabi_idiv0();
}

Was this page helpful? Yes No