Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Dmitry.Neverov via Gdb" <gdb@sourceware.org>
To: gdb@sourceware.org
Subject: symbol files in python
Date: Sat, 25 May 2024 10:58:28 +0200	[thread overview]
Message-ID: <87ttimgte3.fsf@lubuntu2.mail-host-address-is-not-set> (raw)

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

             reply	other threads:[~2024-05-25  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-25  8:58 Dmitry.Neverov via Gdb [this message]
2024-06-26 17:21 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttimgte3.fsf@lubuntu2.mail-host-address-is-not-set \
    --to=gdb@sourceware.org \
    --cc=dmitry.neverov@jetbrains.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox