symbol files in python

"Dmitry.Neverov via Gdb" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
I'm trying to filter out uninitialized variables in a frame by checking
their lines in python, something like this:

sal = frame.find_sal()
frame_line = sal.line
frame_file = sal.symtab.filename

block = frame.block()
while block is not None and block.is_valid():
  for sym in block:
    if sym.line >= frame_line:
      continue
    symtab = sym.symtab
    if symtab is None or symtab.filename != frame_file:
      continue
    # otherwise show symbol as a variable
  if block.function is not None:
      break
  block = block.superblock

Is it correct to expect that symbols in blocks inside a function will
have the same file as the function's frame?

I've noticed that if I add a breakpoint in type::set_num_fields()
(gdb/gdbtypes.h:1002), symtab.filename' for 'this' is 'gdb/mdebugread.c'
and not 'gdb/gdbtypes.h'. Is it expected?

--
Dmitry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.