[v2,0/4] Improve debugging of optimized code

Message ID AM8PR10MB47087C96DA6687BC9336D25AE4209@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM
State New
Headers show

Commit Message

Bernd Edlinger May 30, 2021, 1:58 p.m.
This update was necessary since I've discovered a
crash due to a problem with the recently added
commit 340d00fb783 ("[gdb/breakpoints] Workaround missing line-table entry")

I've again rebased and re-tested the following patches
which are trying to improve the debug experience of
optimized gcc code.

The major change to the previous version is:

[2/4] adds this change to infcmd.c


The BLOCK_END can equal tp->control.step_range_start which caused:
../../binutils-gdb/gdb/infrun.c:2545: internal-error: void resume_1(gdb_signal):
 Assertion `pc_in_thread_step_range (pc, tp)' failed.

The test case gdb.base/empty-inline.exp is enhanced to test the above change.

As before, only [2/4] depends on [1/4], these are about stepping
in inlined code.
The patches [3/4] and [4/4] are about breakpoints,
those do not depend on each other.

Bernd Edlinger (4):
  Introduce a new line table flag is_weak
  Fix range end handling of inlined subroutines
  Fix handling of DW_AT_entry_pc of inlined subroutines
  Skip .cold functions in search_minsyms_for_name

 gdb/block.c                                        |  15 ++-
 gdb/buildsym.c                                     | 103 ++++++++++++++++++---
 gdb/buildsym.h                                     |   3 +
 gdb/dwarf2/read.c                                  |  98 +++++++-------------
 gdb/infcmd.c                                       |   3 +-
 gdb/infrun.c                                       |  33 ++++++-
 gdb/jit.c                                          |   1 +
 gdb/linespec.c                                     |  24 +++++
 gdb/symmisc.c                                      |  10 +-
 gdb/symtab.c                                       |  18 ++--
 gdb/symtab.h                                       |   4 +
 gdb/testsuite/gdb.base/empty-inline.c              |  43 +++++++++
 gdb/testsuite/gdb.base/empty-inline.exp            |  50 ++++++++++
 gdb/testsuite/gdb.cp/empty-inline.cc               |  33 +++++++
 gdb/testsuite/gdb.cp/empty-inline.exp              |  55 +++++++++++
 gdb/testsuite/gdb.cp/step-and-next-inline-1.exp    |  30 ++++++
 gdb/testsuite/gdb.cp/step-and-next-inline.cc       |   6 ++
 gdb/testsuite/gdb.cp/step-and-next-inline.exp      |  97 ++++++++++++-------
 .../gdb.dwarf2/dw2-out-of-range-end-of-seq.exp     |   4 +-
 gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp       |   6 +-
 gdb/xcoffread.c                                    |   1 +
 21 files changed, 505 insertions(+), 132 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/empty-inline.c
 create mode 100644 gdb/testsuite/gdb.base/empty-inline.exp
 create mode 100644 gdb/testsuite/gdb.cp/empty-inline.cc
 create mode 100644 gdb/testsuite/gdb.cp/empty-inline.exp
 create mode 100644 gdb/testsuite/gdb.cp/step-and-next-inline-1.exp


Thanks,
Bernd.

Patch

--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1024,7 +1024,8 @@  enum async_reply_reason
              if (SYMBOL_CLASS (sym) == LOC_BLOCK)
                {
                  const block *block = SYMBOL_BLOCK_VALUE (sym);
-                 if (BLOCK_END (block) < tp->control.step_range_end)
+                 if (BLOCK_END (block) < tp->control.step_range_end
+                     && BLOCK_END (block) > tp->control.step_range_start)
                    tp->control.step_range_end = BLOCK_END (block);
                }
            }