在追查非法指令问题时(不易复现),需要验证自己的调试方式是否可行,就需要制造4) SIGILL非法指令问题进行测试和验证方法的可行性,然后添加到代码中当程序崩溃时打印出有用的信息,下面列出几种方法。
非法函数指针
typedef void(*FUNC)(void);
int main(void)
{
const static unsigned char insn[4] = { 0xff, 0xff, 0xff, 0xff };
FUNC function = (FUNC) insn;
function();
}
提示:非法指令(吐核),Signal Error! Signal is 4
打印非法string