1 from __future__ import generators
4 def read_symbols(file, type=None, dynamic=0):
6 cmd = 'nm -D %s' % file
9 for line in os.popen(cmd, 'r'):
10 if line[0] != ' ': # has an address as first bit of line
15 # we should be up to "type symbolname" now
17 symbol = line[1:].strip()
19 if not type or type == sym_type:
23 if len(sys.argv) != 3:
24 sys.stderr.write('usage: coverage-check library.so wrapper.so\n')
29 # first create a dict with all referenced symbols in the wrapper
30 # should really be a set, but a dict will do ...
32 for symbol in read_symbols(wrapper, type='U', dynamic=1):
33 wrapper_symbols[symbol] = 1
35 # now go through the library looking for matches on the defined symbols:
36 for symbol in read_symbols(library, type='T', dynamic=1):
37 if symbol[0] == '_': continue
38 if symbol not in wrapper_symbols:
41 if __name__ == '__main__':