This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Add discriminator support to gas .loc directive


This patch adds a "discriminator" sub-op to the .loc directive, which
provides gas with the discriminator value to use for a given line
number table entry. Discriminators are a new feature in the DWARF line
number table to support sample-based profiling of code where two or
more basic blocks would otherwise have identical line number
information. The feature has been approved for DWARF version 4, and is
described in detail on the DWARF wiki:

http://wiki.dwarfstd.org/index.php?title=Path_Discriminators

I specifically do not update the DWARF version number in this patch,
since the resulting DWARF will still be compatible with version 2
consumers (all proper consumers should be able to ignore the new
opcode). No change at all in the DWARF info will be seen if there are
no "discriminator" sub-ops in the input assembly source.

I have a related patch for binutils/dwarf.c that I'll send separately
to enable readelf and objdump to print the discriminator information,
and I have a gcc patch that I will soon send to the gcc list that
generates the discriminators when necessary. A subsequent gcc patch
will introduce the sample-based profiling support that will actually
start using this information.

Tested on i386. Is this OK for trunk?

-cary


include/elf/

	* dwarf2.h (DW_LNE_set_discriminator): New enum value.

gas/
	* dwarf2dbg.h (struct dwarf2_line_info): Add discriminator field.
	* dwarf2dbg.c (current): Add discriminator field.
	(dwarf2_where): Copy discriminator value.
	(dwarf2_consume_line_info): Set discriminator to 0.
	(dwarf2_directive_loc): Process discriminator sub-op.
	(out_leb128): New function.
	(process_entries): Output DW_LNE_set_discriminator.

Attachment: gas-discrim-patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]