[PATCH v3 1/3] Introduce a new line table flag is_weak

Bernd Edlinger bernd.edlinger@hotmail.de
Sun Sep 5 19:15:23 GMT 2021


This introduces a new line table flag is_weak.
The line entries at the end of a subroutine range,
use this to indicate that they may possibly
be part of the previous subroutine.

When there is a sequence of line entries at the
same address where an inline range ends, and the
last item has is_stmt = 0, we force all previous
items to have is_weak = 1.

Additionally this adds a "fake" end sequence to the
record_line function, that is line number -1.
That will be used in the next patch.

Finally this adds a handling for empty ranges to
record_block_range.  Currently this function is
not called with empty ranges, but that will be used
in the next patch.

There should be no functional changes after this commit.

gdb:
2021-01-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* buildsym.c (buildsym_compunit::record_block_range): Store inline
	range end PC values.  Make empty inline ranges one byte long.
	(buildsym_compunit::record_line): Update the comment about the
	end of sequence marker.  Mark previous lines at the same PC
	as weak for a fake end sequence marker.
	(buildsym_compunit::patch_inline_end_pos): New helper function.
	(buildsym_compunit::end_symtab_with_blockvector): Patch line table.
	* buildsym.h (buildsym_compunit::m_inline_end_vector): New data item.
	* jit.c (jit_symtab_line_mapping_add_impl): Initialize is_weak.
	* symmisc.c (dump_symtab_1,
	maintenance_print_one_line_table): Handle is_weak.
	* symtab.h (linetable_entry::is_weak,
	symtab_and_line::is_weak): New data items.
	* xcoffread.c (arrange_linetable): Initialize is_weak.

gdb/testsuite:
2021-01-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* gdb.dwarf2/dw2-ranges-base.exp: Adjust test, handle WEAK.
	* gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: Likewise.
---
 gdb/buildsym.c                                     | 103 ++++++++++++++++++---
 gdb/buildsym.h                                     |   3 +
 gdb/jit.c                                          |   1 +
 gdb/symmisc.c                                      |  10 +-
 gdb/symtab.h                                       |   4 +
 .../gdb.dwarf2/dw2-out-of-range-end-of-seq.exp     |   4 +-
 gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp       |   6 +-
 gdb/xcoffread.c                                    |   1 +
 8 files changed, 111 insertions(+), 21 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Introduce-a-new-line-table-flag-is_weak.patch
Type: text/x-patch
Size: 13291 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/gdb-patches/attachments/20210905/6b2aa661/attachment-0001.bin>


More information about the Gdb-patches mailing list