summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2016-11-14 16:22:42 +0100
committerhjk <hjk@qt.io>2016-11-16 09:32:42 +0000
commitb26400e8efc5a582e92ff6ad3226bf22eab5f7c2 (patch)
tree2d476ddee1ba3518070526246b5a25f44d903c39 /share
parent36d4d01cd374a21a8b7c229b261c5f1a23d1184e (diff)
downloadqt-creator-b26400e8efc5a582e92ff6ad3226bf22eab5f7c2.tar.gz
Debugger: Workaround gdb.lookup_symbol ignoring QArrayData::shared_null
There have been cases observed where 'p QArrayData::shared_null' finds valid symbols that are not found using gdb.lookup_symbols. The cause for that is unknown. Apply an expensive workaround by checking for (the equivalent of) a working 'p QArrayData::shared_null' but execute it only when a libQt5Core was found. This keeps the overhead for non-Qt setups at a bearable (unsuccessful) iteration over known shared object names. Change-Id: Id398673b938d3c3a72c24317abdbefbe793e54df Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/debugger/gdbbridge.py44
1 files changed, 24 insertions, 20 deletions
diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py
index 9877c54c29..3612dcdb4f 100644
--- a/share/qtcreator/debugger/gdbbridge.py
+++ b/share/qtcreator/debugger/gdbbridge.py
@@ -1014,30 +1014,34 @@ class Dumper(DumperBase):
if not self.currentQtNamespaceGuess is None:
return self.currentQtNamespaceGuess
- # This only works when called from a valid frame.
- try:
- cand = 'QArrayData::shared_null'
- symbol = gdb.lookup_symbol(cand)[0]
- if symbol:
- ns = symbol.name[:-len(cand)]
- self.qtNamespaceToReport = ns
- self.qtNamespace = lambda: ns
- return ns
- except:
- pass
+ for objfile in gdb.objfiles():
+ name = objfile.filename
+ if name.find('/libQt5Core') >= 0:
+ ns = ''
- try:
- # This is Qt, but not 5.x.
- cand = 'QByteArray::shared_null'
- symbol = gdb.lookup_symbol(cand)[0]
- if symbol:
- ns = symbol.name[:-len(cand)]
+ # This only works when called from a valid frame.
+ try:
+ cand = 'QArrayData::shared_null'
+ symbol = gdb.lookup_symbol(cand)[0]
+ if symbol:
+ ns = symbol.name[:-len(cand)]
+ except:
+ try:
+ # Some GDB 7.11.1 on Arch Linux.
+ cand = 'QArrayData::shared_null[0]'
+ val = gdb.parse_and_eval(cand)
+ if val.type is not None:
+ typeobj = val.type.unqualified()
+ ns = typeobj.name[:-len('QArrayData')]
+ except:
+ pass
+
+ # This might be wrong, but we can't do better: We found
+ # a libQt5Core and could not extract a namespace.
+ # The best guess is that there isn't any.
self.qtNamespaceToReport = ns
self.qtNamespace = lambda: ns
- self.fallbackQtVersion = 0x40800
return ns
- except:
- pass
self.currentQtNamespaceGuess = ''
return ''