23 wait frames, 30 objects, nothing unresolved -- the second deref turns every former miss into a resolved object, as predicted. XEvent 20 / XSemaphore 9 / XTimer 1; every WaitMultiple thread waits on a pair, and 78/79/80 and 64/65 are worker groups sharing a handle. %ebp does not survive as the count -- WaitMultiple reuses it at 8fc158 -- so the array is bounded by reading until an entry stops resolving instead. The frozen capture is still not taken: screen_id reads 'flight' at the second capture and out to ~470s, so the mission never black-screened. The diff in the data file is two healthy captures and is recorded as such.
82 lines
3.1 KiB
Python
Executable File
82 lines
3.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Turn the gdb wait-object dumps into a table, discarding what does not check out.
|
|
|
|
The two waiting functions do not put the same thing in %rbx (see
|
|
freeze_waitobj.sh), so they are parsed separately:
|
|
|
|
Wait rbx = this -> [rbx] is the vtable
|
|
WaitMultiple rbx = XObject** -> [[rbx+8i]] is object i's vtable
|
|
|
|
%ebp holds the count only at the prologue: WaitMultiple reuses it at 8fc158
|
|
(`mov 0x10(%rax),%ebp`), and it reads 0 at the point these captures interrupt.
|
|
So the array length is NOT taken from a register -- entries are read until one
|
|
stops resolving, which is the same self-validating rule used for everything
|
|
else here.
|
|
|
|
Every reading is validated the same way: gdb's `info symbol` must resolve it to
|
|
a `vtable for ...` symbol. A polymorphic object's first word always is one, so
|
|
anything else is a misread and is COUNTED but not interpreted. That check is
|
|
what the reading is worth -- without it a stale register looks like a result.
|
|
"""
|
|
import re, sys, collections
|
|
|
|
VT = re.compile(r'vtable for ([\w:]+) \+ (\d+)')
|
|
HDR = re.compile(r'=== (\w+) T(\d+) (Wait|WaitMultiple) f(\d+) ===')
|
|
|
|
def parse(tag):
|
|
"""-> list of (thread, kind, count, [vtable-or-None per slot])"""
|
|
try:
|
|
txt = open('/tmp/fz-obj-%s.txt' % tag, errors='replace').read()
|
|
except FileNotFoundError:
|
|
return []
|
|
out, cur = [], None
|
|
for line in txt.splitlines():
|
|
line = line.replace('(gdb) ', '')
|
|
h = HDR.search(line)
|
|
if h:
|
|
if cur: out.append(cur)
|
|
cur = dict(th=h.group(2), kind=h.group(3), count=None, slots=[], bad=0)
|
|
continue
|
|
if not cur: continue
|
|
m = re.search(r'rbp\s+0x[0-9a-f]+\s+(\d+)', line)
|
|
if m: cur['count'] = int(m.group(1)) & 0xffffffff
|
|
if 'info symbol' in line or line.startswith('$'): continue
|
|
v = VT.search(line)
|
|
if v:
|
|
cur['slots'].append(v.group(1))
|
|
elif 'No symbol matches' in line:
|
|
cur['slots'].append(None); cur['bad'] += 1
|
|
if cur: out.append(cur)
|
|
return out
|
|
|
|
def report(tag):
|
|
recs = parse(tag)
|
|
print('=== %s: %d wait frames ===' % (tag, len(recs)))
|
|
if not recs: return collections.Counter()
|
|
tally = collections.Counter()
|
|
for r in recs:
|
|
# take entries up to the first one that did not resolve
|
|
live = []
|
|
for s_ in r['slots']:
|
|
if s_ is None: break
|
|
live.append(s_)
|
|
for s in live:
|
|
tally[s if s else '<unresolved>'] += 1
|
|
print(' T%-4s %-13s n=%d %s' % (
|
|
r['th'], r['kind'], len(live),
|
|
', '.join(live) or '(nothing readable)'))
|
|
print(' --- objects waited on:')
|
|
for k, c in tally.most_common():
|
|
print(' %-45s %d' % (k, c))
|
|
return tally
|
|
|
|
if __name__ == '__main__':
|
|
tallies = {t: report(t) for t in (sys.argv[1:] or ['healthy'])}
|
|
if len(tallies) > 1:
|
|
a, b = list(tallies)
|
|
print('=== %s -> %s ===' % (a, b))
|
|
keys = set(tallies[a]) | set(tallies[b])
|
|
for k in sorted(keys):
|
|
x, y = tallies[a][k], tallies[b][k]
|
|
print(' %-45s %3d -> %-3d %s' % (k, x, y, '' if x == y else ' CHANGED'))
|