forked from qt-creator/qt-creator
Debugger: Fix "Break on Abort" with GDB > 8.1
GDB 8.1 changed behavior when specifying breakpoints, it now tries to pattern-match function names, hitting e.g. 'Foo::abort()' for 'b ::abort'. While the API exposes a way to opt-out of the new behavior there's no way to tell when to do that other than trial-and-error. Task-number: QTBUG-73993 Change-Id: Ied2e640e65e40df6eac50117db890bd4b51d36ab Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -892,16 +892,33 @@ class Dumper(DumperBase):
|
||||
def createSpecialBreakpoints(self, args):
|
||||
self.specialBreakpoints = []
|
||||
def newSpecial(spec):
|
||||
class SpecialBreakpoint(gdb.Breakpoint):
|
||||
# GDB < 8.1 does not have the 'qualified' parameter here,
|
||||
# GDB >= 8.1 applies some generous pattern matching, hitting
|
||||
# e.g. also Foo::abort() when asking for '::abort'
|
||||
class Pre81SpecialBreakpoint(gdb.Breakpoint):
|
||||
def __init__(self, spec):
|
||||
super(SpecialBreakpoint, self).\
|
||||
__init__(spec, gdb.BP_BREAKPOINT, internal=True)
|
||||
super(Pre81SpecialBreakpoint, self).__init__(spec,
|
||||
gdb.BP_BREAKPOINT, internal=True)
|
||||
self.spec = spec
|
||||
|
||||
def stop(self):
|
||||
print("Breakpoint on '%s' hit." % self.spec)
|
||||
return True
|
||||
return SpecialBreakpoint(spec)
|
||||
|
||||
class SpecialBreakpoint(gdb.Breakpoint):
|
||||
def __init__(self, spec):
|
||||
super(SpecialBreakpoint, self).__init__(spec,
|
||||
gdb.BP_BREAKPOINT, internal=True, qualified=True)
|
||||
self.spec = spec
|
||||
|
||||
def stop(self):
|
||||
print("Breakpoint on '%s' hit." % self.spec)
|
||||
return True
|
||||
|
||||
try:
|
||||
return SpecialBreakpoint(spec)
|
||||
except:
|
||||
return Pre81SpecialBreakpoint(spec)
|
||||
|
||||
# FIXME: ns is accessed too early. gdb.Breakpoint() has no
|
||||
# 'rbreak' replacement, and breakpoints created with
|
||||
|
||||
Reference in New Issue
Block a user