public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Andrea Monaco <andrea.monaco@autistici.org>
To: dblaikie@gmail.com
Cc: gdb@sourceware.org
Subject: Re: gdb displaying only one line of instructions when stepping
Date: Tue, 21 Dec 2021 23:14:30 +0100	[thread overview]
Message-ID: <87bl19hagp.fsf@autistici.org> (raw)
In-Reply-To: CAENS6EudpGD+52w4GF=DdUQ9MbDy7-u=BRnqkhx1ox1i6Y0=iQ@mail.gmail.com


  > Though ultimately the DWARF format itself would probably need to be
  > improved to describe source ranges (maybe even non-contiguous ones)
  > and a preferred location - then then + operation could be described
  > as the whole range of "x + y" with a specific location of '+', and
  > the assignment could be the whole range of "a = x + y" with a
  > specific location of '='.


I looked up DWARF format a bit using the dwarfdump utility.  I see that
DWARF records the line number of each new instruction.  Changing the
format would be a lot of work; but maybe some kind of heuristics might
do the job.


When single stepping, gdb could display all lines until the following
instruction, excluding it, and also excluding blank lines and (perhaps)
comments immediately before it.

As another rule, it might stop immediately (like it does now) when the
current line is, or includes, the closing bracket of a function.  (I saw
that gcc records the closing bracket as a separate instruction, even
when it is on the same line as the last instruction of the function.)


This heuristics may give reasonable results in many cases, or be a
starting point.  What do you think?



Andrea Monaco

             reply	other threads:[~2021-12-21 22:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 22:14 Andrea Monaco [this message]
2021-12-21 22:54 ` David Blaikie
  -- strict thread matches above, loose matches on Subject: below --
2021-12-21 14:15 Andrea Monaco
2021-12-21 14:21 ` David Blaikie

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=87bl19hagp.fsf@autistici.org \
    --to=andrea.monaco@autistici.org \
    --cc=dblaikie@gmail.com \
    --cc=gdb@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).