symbol files in python

Dmitry.Neverov dmitry.neverov@jetbrains.com
Sat May 25 08:58:28 GMT 2024


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


More information about the Gdb mailing list