[PATCH 0/2] Handle "line 0" ranges (PR26243, PR15314, PR15668)

Pedro Alves pedro@palves.net
Tue Jul 21 15:37:35 GMT 2020


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



More information about the Gdb-patches mailing list