#! /usr/bin/env python

import sys
import os
import commands
import re

libs = sys.argv[1:]

regexp = re.compile(r'[\da-fA-F]+\s+([DdSsBb])\s+([_a-zA-Z\d\.]+)')

def demangle(x):
    return x[1:]

for lib in libs:
    text = commands.getoutput("nm %s" % lib)
    matches = regexp.findall(text)
    for typ, name in matches:
        name = demangle(name)
        if "." in name:
            #static fxn variable... ignore for now
            continue
        print name


