Commit: Add support for DWARF-5 .debug_line sections

Nick Clifton nickc@redhat.com
Wed Mar 11 10:16:58 GMT 2020
Hi Guys,

  I am applying the attached patch to add support for DWARF-5
  .debug_line sections.  DWARF v5 changes the format of the
  section's header so that the layout of the directory table and the
  file table are explicitly specified.  This allow for extra fields
  and also the possibility of reducing the size of the tables by not
  storing unneeded fields.

  The patch also extended the .file directive so that it can take an
  optional directory name and md5 sum, like this:

    .file <fileno> [<dirname>] <filename> [md5 <value>]

  The md5 sum is a hash of the source file, so that consumers can verify
  that any file that they locate matches the debug information.

  As part of the patch I have also updated the DWARF decoder used by
  readelf and objdump to enhance its display of version 5 directory and
  file name tables.
  
Cheers
  Nick

binutils/ChangeLog
2020-03-11  Nick Clifton  <nickc@redhat.com>

	PR 25611
	PR 25614
	* dwarf.h (DWARF2_Internal_LineInfo): Add li_address_size and
	li_segment_size fields.
	* dwarf.c (read_debug_line_header): Record the address size and
	segment selector size values (if present) in the lineinfo
	structure.
	(display_formatted_table): Warn if the format count is empty but
	the table itself is not empty.
	Display the format count and entry count at the start of the table
	dump.
	(display_debug_lines_raw): Display the address size and segement
	selector size fields, if present.
	* testsuite/binutils-all/dw5.W: Update expected output.

gas/ChangeLog
2020-03-11  Nick Clifton  <nickc@redhat.com>

	PR 25611
	PR 25614
	* dwarf2dbg.c (DWARF2_FILE_TIME_NAME): Default to -1.
	(DWARF2_FILE_SIZE_NAME): Default to -1.
	(DWARF2_LINE_VERSION): Default to the current dwarf level or 3,
	whichever is higher.
	(DWARF2_LINE_MAX_OPS_PER_INSN): Provide a default value of 1.
	(NUM_MD5_BYTES): Define.
	(struct file entry): Add md5 field.
	(get_filenum): Delete and replace with...
	(get_basename): New function.
	(get_directory_table_entry): New function.
	(allocate_filenum): New function.
	(allocate_filename_to_slot): New function.
	(dwarf2_where): Use new functions.
	(dwarf2_directive_filename): Add support for extended .file
	pseudo-op.
	(dwarf2_directive_loc): Allow the use of file number zero with
	DWARF 5 or higher.
	(out_file_list): Rename to...
	(out_dir_and_file_list): Add DWARF 5 support.
	(out_debug_line): Emit extra values into the section header for
	DWARF 5.
	(out_debug_str): Allow for file 0 to be used with DWARF 5.
	* doc/as.texi (.file): Update the description of this pseudo-op.
	* testsuite/gas/elf-dwarf-5-file0.s: Add more lines.
	* testsuite/gas/elf-dwarf-5-file0.d: Update expected dump output.
	* testsuite/gas/lns/lns-diag-1.l: Update expected error message.
	* NEWS: Mention the new feature.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: md5.gas.patch
Type: text/x-patch
Size: 35123 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20200311/bd0cb71c/attachment.bin>


More information about the Binutils mailing list