4.57 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

The following example shows how to intercept __aeabi_div0 using the $Super$$ and $Sub$$ mechanism.
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();
}
Related concepts
4.53 Integer division-by-zero errors in C code
4.54 About trapping integer division-by-zero errors with __aeabi_idiv0()
4.55 About trapping integer division-by-zero errors with __rt_raise()
4.56 Identification of integer division-by-zero errors in C code
Related information
Run-time ABI for the ARM Architecture
Non-ConfidentialPDF file icon PDF versionARM DUI0375E
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.