Commit c9c0f801 authored by hjk's avatar hjk

Debugger: Fix threadname display

We probably should completely skip the code in the cases where Qt
itself already propagates the object name to the underlying threads.

Task-number: QTCREATORBUG-10826
Change-Id: I7e9e5b7c990a270c8563e40c1fe1e900724c1e5c
Reviewed-by: default avatarRyan May <ryan.may@eecradar.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 17f70460
...@@ -1568,7 +1568,7 @@ class Dumper(DumperBase): ...@@ -1568,7 +1568,7 @@ class Dumper(DumperBase):
result += ']' result += ']'
return result return result
def threadname(self, maximalStackDepth): def threadname(self, maximalStackDepth, objectPrivateType):
e = gdb.selected_frame() e = gdb.selected_frame()
out = "" out = ""
ns = self.qtNamespace() ns = self.qtNamespace()
...@@ -1583,8 +1583,7 @@ class Dumper(DumperBase): ...@@ -1583,8 +1583,7 @@ class Dumper(DumperBase):
or e.name() == "_ZN14QThreadPrivate5startEPv@4": or e.name() == "_ZN14QThreadPrivate5startEPv@4":
try: try:
thrptr = e.read_var("thr").dereference() thrptr = e.read_var("thr").dereference()
obtype = self.lookupType(ns + "QObjectPrivate").pointer() d_ptr = thrptr["d_ptr"]["d"].cast(objectPrivateType).dereference()
d_ptr = thrptr["d_ptr"]["d"].cast(obtype).dereference()
try: try:
objectName = d_ptr["objectName"] objectName = d_ptr["objectName"]
except: # Qt 5 except: # Qt 5
...@@ -1614,10 +1613,11 @@ class Dumper(DumperBase): ...@@ -1614,10 +1613,11 @@ class Dumper(DumperBase):
oldthread = gdb.selected_thread() oldthread = gdb.selected_thread()
if oldthread: if oldthread:
try: try:
objectPrivateType = gdb.lookup_type(ns + "QObjectPrivate").pointer()
inferior = self.selectedInferior() inferior = self.selectedInferior()
for thread in inferior.threads(): for thread in inferior.threads():
thread.switch() thread.switch()
out += self.threadname(maximalStackDepth) out += self.threadname(maximalStackDepth, objectPrivateType)
except: except:
pass pass
oldthread.switch() oldthread.switch()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment