为何在汇编代码中调用strlen会触发段错误?
段错误问题:strlen调用导致程序崩溃
尝试向localhost发起请求并获取消息长度时,程序触发段错误,具体信息如下:
程序输出
helloS helloS helloS helloS helloS helloS helloS helloS helloS helloS helloS helloS helloS helloS helloS helloS./run.sh: line 1: 10066 Segmentation fault: 11
lldb调试信息

代码对比
原代码中使用以下汇编指令获取消息长度时出现崩溃:
adr x0, _msg bl _strlen
将上述代码替换为直接赋值后,程序可正常运行:
mov x0, #5
内容的提问来源于stack exchange,提问作者Den Avrondo
相关产品推荐
相关产品推荐

