public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 0/2] Handle "line 0" ranges (PR26243, PR15314, PR15668)
Date: Fri, 24 Jul 2020 12:26:07 +0100	[thread overview]
Message-ID: <3947b419-9c61-e92f-6095-0d08129e8cc1@palves.net> (raw)
In-Reply-To: <3c779fff-3bb5-db0e-e140-9cfca8366696@simark.ca>

On 7/21/20 4:48 PM, Simon Marchi wrote:
> On 2020-07-21 11:37 a.m., Pedro Alves wrote:
>> PR 26243 shows that Clang associates some instructions in the middle
>> of functions to line 0.  That is valid DWARF, but it wasn't noticed
>> until recently, when the line info reading code was tweaked.
>> Currently, "step" and "next" with Clang misbehave because these "line
>> 0" instructions or instruction ranges aren't being handled.
>>
>> This series fixes that in two parts:
>>
>> #1 - By teaching infrun to step over such no-line-info instructions
>>      automatically, when "set step-mode" is "off" (which is the
>>      default).
>>
>> #2 - By making "step" and "next" behave like "stepi" and "nexti"
>>      respectively when a step is started at an instruction with no
>>      line info.
>>
>> I think that with the first patch, most users won't frequently notice
>> these "no line info" regions unless they use stepi to run to them, or
>> they set a breapoint by address in them.  But it can happen that you
>> stop in one of them, and I think that making "step" not step out of
>> the whole function is just a good idea if it does happen.  The second
>> patch also fixes the older PR15314 and PR15668, because the error in
>> question they are complaining about is removed by that patch.
>>
>> I think we could also try to fix the issue addressed by #2 by making a
>> "step" started at an instruction with no line info step until it finds
>> an instruction with line info (maybe in the same function, maybe in a
>> different function), instead of stepping out of the current function.
>> I do think that the behavior I'm proposing is more intuitive, though.
>>
>> Pedro Alves (2):
>>   Keep stepping over "line 0" ranges (PR 26243)
>>   Make step act as stepi if no line info (PR26243, PR15314, PR15668)
>>
>>  gdb/doc/gdb.texinfo                               |  36 ++--
>>  gdb/NEWS                                          |   5 +
>>  gdb/infcmd.c                                      |  30 +--
>>  gdb/infrun.c                                      |  47 +++--
>>  gdb/testsuite/gdb.base/step-symless.exp           |  20 +-
>>  gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.c   |  61 ++++++
>>  gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp | 240 ++++++++++++++++++++++
>>  7 files changed, 383 insertions(+), 56 deletions(-)
>>  create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.c
>>  create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
>>
>>
>> base-commit: 6d3d6e4ba779dc08b134cd1a09b055dbd88dbf8a
>> -- 
>> 2.14.5
>>
> 
> Because it can affect what kind of other bugfixes and mitigation we do
> and how this patchset is discussed, my first question is: do you suggest
> merging these patches before the GDB 10 branch is created or waiting
> after the branch?

At this point, I think it would be safer to go with Vries' approach
for GDB 10.  Also, I will be out of office the whole of next week,
so I wouldn't be around to handle any fallout.  

Also, I'm going to use a GDB with patch #2 from this series for all
my debugging for a while, see how will it holds up in practice.

Thanks,
Pedro Alves

  reply	other threads:[~2020-07-24 11:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 15:37 Pedro Alves
2020-07-21 15:37 ` [PATCH 1/2] Keep stepping over "line 0" ranges (PR 26243) Pedro Alves
2020-07-21 16:38   ` Eli Zaretskii
2020-07-21 15:37 ` [PATCH 2/2] Make step act as stepi if no line info (PR26243, PR15314, PR15668) Pedro Alves
2020-07-21 16:40   ` Eli Zaretskii
2020-07-21 15:48 ` [PATCH 0/2] Handle "line 0" ranges " Simon Marchi
2020-07-24 11:26   ` Pedro Alves [this message]
2020-12-27 22:17     ` Simon Marchi

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=3947b419-9c61-e92f-6095-0d08129e8cc1@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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).