Debugger: Ignore stops in libart.so and other Android runtime specific places

From https://issuetracker.google.com/issues/240007217#comment17
"Some a background on the technical aspect of SEGVs:

Android Runtime (ART) uses SEGV for various internal purposes (it
triggers a SEGV and handles it without crashing the app, the app doesn't
know it happened). When the native debugger is connected, the debugger
must intercept all SEGV signals.

When running the debugger on Android API level 27 and newer, we make the
debugger skip these SEGV signals (i.e., forward them to be handled by
ART), because we know how to handle real SEGV signals inside ART.  For
older Android versions (26 or older), we did not have this support, so
the debugger stops at every SEGV (i.e., it cannot know if the signal is
a real crash or an ART-internal thing)."

Arguably, this should be caught by the LLDB Android platform bits, but...

Task-number: QTCREATORBUG-30759
Task-number: QTCREATORBUG-29928
Task-number: QTCREATORBUG-30080

Change-Id: I8cabe4a0675c596a9617520aff0d62ad11321f0e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2024-04-29 18:46:04 +02:00
parent 67ab041903
commit d3fb3a163c

View File

@@ -1456,6 +1456,21 @@ class Dumper(DumperBase):
if bp is not None:
self.reportBreakpointUpdate(bp)
def wantAutoContinue(self, frame):
if self.platform_ != 'remote-android':
return False
funcname = frame.GetFunctionName()
if funcname and funcname.startswith('java.'):
return True
module = frame.GetModule()
filespec = module.GetPlatformFileSpec() # Not GetFileSpec
filename = filespec.GetFilename()
if filename == 'libart.so':
return True
if funcname == None and not frame.line_entry.file.IsValid() and filename == None:
return True
return False
def handleEvent(self, event):
if lldb.SBBreakpoint.EventIsBreakpointEvent(event):
self.handleBreakpointEvent(event)
@@ -1490,8 +1505,12 @@ class Dumper(DumperBase):
if state == lldb.eStateStopped:
stoppedThread = self.firstStoppedThread()
if stoppedThread:
#self.report("STOPPED THREAD: %s" % stoppedThread)
frame = stoppedThread.GetFrameAtIndex(0)
if self.wantAutoContinue(frame):
#self.warn("AUTO CONTINUE")
error = self.process.Continue()
return
#self.report("FRAME: %s" % frame)
function = frame.GetFunction()
functionName = function.GetName()