Commit 41d0bbdc authored by David Chase's avatar David Chase

cmd/link: include DW_AT_producer in .debug_info

This can make life easier for Delve (and other debuggers),
and can help them with bug reports.

Sample producer field (from objdump):
<48> DW_AT_producer : Go cmd/compile devel +8a59dbf41a Mon May 8 16:02:44 2017 -0400

Change-Id: I0605843c959b53a60a25a3b870aa8755bf5d5b13
Reviewed-on: https://go-review.googlesource.com/33588
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 9bced477
...@@ -197,6 +197,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{ ...@@ -197,6 +197,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{
{DW_AT_high_pc, DW_FORM_addr}, {DW_AT_high_pc, DW_FORM_addr},
{DW_AT_stmt_list, DW_FORM_data4}, {DW_AT_stmt_list, DW_FORM_data4},
{DW_AT_comp_dir, DW_FORM_string}, {DW_AT_comp_dir, DW_FORM_string},
{DW_AT_producer, DW_FORM_string},
}, },
}, },
......
...@@ -1024,6 +1024,8 @@ func writelines(ctxt *Link, syms []*Symbol) ([]*Symbol, []*Symbol) { ...@@ -1024,6 +1024,8 @@ func writelines(ctxt *Link, syms []*Symbol) ([]*Symbol, []*Symbol) {
// OS X linker requires compilation dir or absolute path in comp unit name to output debug info. // OS X linker requires compilation dir or absolute path in comp unit name to output debug info.
compDir := getCompilationDir() compDir := getCompilationDir()
newattr(dwinfo, dwarf.DW_AT_comp_dir, dwarf.DW_CLS_STRING, int64(len(compDir)), compDir) newattr(dwinfo, dwarf.DW_AT_comp_dir, dwarf.DW_CLS_STRING, int64(len(compDir)), compDir)
producer := "Go cmd/compile " + objabi.Version
newattr(dwinfo, dwarf.DW_AT_producer, dwarf.DW_CLS_STRING, int64(len(producer)), producer)
// Write .debug_line Line Number Program Header (sec 6.2.4) // Write .debug_line Line Number Program Header (sec 6.2.4)
// Fields marked with (*) must be changed for 64-bit dwarf // Fields marked with (*) must be changed for 64-bit dwarf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment