Android NDK Segmentation Error

前端 未结 3 1836
面向向阳花
面向向阳花 2021-01-19 10:40

In my application when I try to print my logs into file at that Time facing Segmentation Error .

I am facing Fatal Signal 11 .

My log function is into Native

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-19 11:25

    The segmentation fault signal points to some type of memory problem and, taking into account that you set logMessage and tmpString to the same length and you're filling logMessage with several arguments plus the content in tmpString, as Peter states, is very possible that you're running into a buffer overflow.

    Initially, logMessage's length should be: MAX_APPNAME_LEN + MAX_DEBUG_LEN + 4 + MAX_TIMESTAMP_LEN + MAX_MODULENAME_LEN + PATHLENGTH.

提交回复
热议问题