in cbmc_viewer/symbol_table.py [0:0]
def symbol_definitions(goto, wkdir, srcdir=None):
"""Symbol definitions appearing in symbol table.
Source file path names in symbol table are absolute or relative to
wkdir. If srcdir is given, return only symbols defined in files
under srcdir.
"""
wkdir = srcloct.abspath(wkdir)
srcdir = srcloct.abspath(srcdir)
symbols = {}
for dfn in parse_symbol_table(symbol_table(goto), wkdir):
sym, src, num = dfn['symbol'], dfn['file'], dfn['line']
if sym is None or src is None or num is None:
logging.info("Skipping symbol table entry: %s: %s, %s",
sym, src, num)
continue
if srcdir and not src.startswith(srcdir):
logging.info("Skipping symbol table entry: %s: %s, %s",
sym, src, num)
continue
srcloc = srcloct.make_srcloc(src, None, num, wkdir, srcdir)
if sym in symbols and srcloc != symbols[sym]:
logging.warning("Skipping redefinition of symbol name: %s", sym)
logging.warning(" Old symbol %s: file %s, line %s",
sym, symbols[sym]["file"], symbols[sym]["line"])
logging.warning(" New symbol %s: file %s, line %s",
sym, srcloc["file"], srcloc["line"])
continue
symbols[sym] = srcloc
return symbols