public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Handle "line 0" ranges (PR26243, PR15314, PR15668)
@ 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
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pedro Alves @ 2020-07-21 15:37 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-27 22:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 15:37 [PATCH 0/2] Handle "line 0" ranges (PR26243, PR15314, PR15668) 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
2020-12-27 22:17     ` Simon Marchi

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).