简体   繁体   English

“ svc#128”意外闯入调试器-如何调试?

[英]“svc #128” breaking in to debugger unexpectedly - how to debug?

There are a series of StackOverflow questions that mention unexpectedly breaking in to the debugger after a svc #128 instruction. 有一系列StackOverflow问题,提到在svc #128指令后意外插入调试器。 In dealing with this issue myself, I'd like to ask some general questions about when and why this occurs. 我本人在处理此问题时,想问一些有关何时以及为什么发生这种情况的一般性问题。

  • In detail what svc #128 is used for in iOS? 详细地说,iOS中使用的svc #128是什么?
  • What causes it to break in to the debugger? 是什么导致它闯入调试器?
  • Is there a way of suppressing breaking in to the debugger during development? 有没有一种方法可以抑制开发期间闯入调试器?
  • Possible methods to debug the underlying cause of this issue? 可能的方法来调试此问题的根本原因?
  • Successful fixes that people have used in the past? 人们过去使用过成功的修补程序吗?

The svc #128 or svc 0x80 call is the Supervisor Call within the ARM instruction set ( ARM Documentation ). svc #128svc 0x80调用是ARM指令集中的“ Supervisor Call ”(《 ARM文档》 )。 You need to look at the register value to indicate what's being called. 您需要查看寄存器值以指示正在调用的内容。

Example assembler: 汇编程序示例:

libsystem_kernel.dylib`__pthread_kill:
0x195557268:  movz   x16, #328                 // NOTE THIS VALUE
0x19555726c:  svc    #128
0x195557270:  b.cc   0x195557288               ; __pthread_kill + 32
...

Lookup the movz value (in this case #328 ) in this table of Kernel System Calls . 在“ 内核系统调用”表中查找movz值(在这种情况下为#328 )。 For #328 , this corresponds to pthread_kill , which matches the name of the method listed above. 对于#328 ,它对应于pthread_kill ,它与上面列出的方法名称匹配。 When the interrupt is called, it will land on the instruction immediately after svc , in this example the b.cc instruction. 调用该中断时,该中断将紧接svc之后的指令,在本例中为b.cc指令。

Note that LLDB also breaks for certain thread to thread signals, eg SIGUSR2, even if it's intentional and correct. 注意,LLDB也会中断某些线程到线程的信号,例如SIGUSR2,即使它是有意且正确的。 You can configure Xcode to ignore this and continue execution without an issue: 您可以配置Xcode忽略它并继续执行而不会出现问题:

Permanently configuring LLDB (in Xcode 4.3.2) not to stop on signals 永久配置LLDB(在Xcode 4.3.2中)不停止信号

Thanks to Notlikethat for their input 感谢Notlikethat的投入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM