Stream: git-wasmtime

Topic: wasmtime / Issue #1988 DWARF-5 line section directories w...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 12:26):

ggreif labeled Issue #1988:

For a DWARF-5 equipped .wasm file, translated to .o (via wasmtime wasm2obj -g) the containing directories are mixed up:

.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x000288fa
         version: 5
...
include_directories[  0] = "."
include_directories[  1] = "<moc-asset>"
include_directories[  2] = "tests/debug/testsuite"
file_names[  0]:
           name: "fib-wasm.mo"
      dir_index: 2
file_names[  1]:
.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x0000e747
         version: 4
...
include_directories[  1] = "."
include_directories[  2] = "<moc-asset>"
include_directories[  3] = "tests/debug/testsuite"
file_names[  1]:
           name: "fib-wasm.mo"
      dir_index: 2

Since the latter is one-based, the index but be incremented.

(I'm working on a PR.)

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 12:26):

ggreif opened Issue #1988:

For a DWARF-5 equipped .wasm file, translated to .o (via wasmtime wasm2obj -g) the containing directories are mixed up:

.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x000288fa
         version: 5
...
include_directories[  0] = "."
include_directories[  1] = "<moc-asset>"
include_directories[  2] = "tests/debug/testsuite"
file_names[  0]:
           name: "fib-wasm.mo"
      dir_index: 2
file_names[  1]:
.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x0000e747
         version: 4
...
include_directories[  1] = "."
include_directories[  2] = "<moc-asset>"
include_directories[  3] = "tests/debug/testsuite"
file_names[  1]:
           name: "fib-wasm.mo"
      dir_index: 2

Since the latter is one-based, the index but be incremented.

(I'm working on a PR.)

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 12:26):

ggreif edited Issue #1988:

For a DWARF-5 equipped .wasm file, translated to .o (via wasmtime wasm2obj -g) the containing directories are mixed up:

.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x000288fa
         version: 5
...
include_directories[  0] = "."
include_directories[  1] = "<moc-asset>"
include_directories[  2] = "tests/debug/testsuite"
file_names[  0]:
           name: "fib-wasm.mo"
      dir_index: 2
file_names[  1]:
.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x0000e747
         version: 4
...
include_directories[  1] = "."
include_directories[  2] = "<moc-asset>"
include_directories[  3] = "tests/debug/testsuite"
file_names[  1]:
           name: "fib-wasm.mo"
      dir_index: 2

Since the latter is one-based, the index must be incremented.

(I'm working on a PR.)

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 12:33):

ggreif commented on Issue #1988:

Alternatively we could honour this commentary from the DWARF-5 standard:

Prior to DWARF Version 5, the current directory was not represented in the directories field and a directory index of 0 implicitly referred to that directory as found in the DW_AT_comp_dir attribute of the compilation unit debugging information entry. In DWARF Version 5, the current directory is explicitly present in the directories field. This is needed to support the common practice of stripping all but the line number sections (.debug_line and .debug_line_str) from an executable.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 12:33):

ggreif edited a comment on Issue #1988:

Alternatively we could honour this commentary from the DWARF-5 standard:

Prior to DWARF Version 5, the current directory was not represented in the directories field and a directory index of 0 implicitly referred to that directory as found in the DW_AT_comp_dir attribute of the compilation unit debugging information entry. In DWARF Version 5, the current directory is explicitly present in the directories field. This is needed to support the common practice of stripping all but the line number sections (.debug_line and .debug_line_str) from an executable.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 12:37):

ggreif edited a comment on Issue #1988:

Alternatively we could honour this commentary from the DWARF-5 standard:

Prior to DWARF Version 5, the current directory was not represented in the directories field and a directory index of 0 implicitly referred to that directory as found in the DW_AT_comp_dir attribute of the compilation unit debugging information entry. In DWARF Version 5, the current directory is explicitly present in the directories field. This is needed to support the common practice of stripping all but the line number sections (.debug_line and .debug_line_str) from an executable.
This is a bit more involved, since, it needs to compare the translation unit's directory with the DWARF-5 .debug_line section's include_directories[0] entry, and when equal, jettison the latter, keeping the file indices.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 12:37):

ggreif edited a comment on Issue #1988:

Alternatively we could honour this commentary from the DWARF-5 standard:

Prior to DWARF Version 5, the current directory was not represented in the directories field and a directory index of 0 implicitly referred to that directory as found in the DW_AT_comp_dir attribute of the compilation unit debugging information entry. In DWARF Version 5, the current directory is explicitly present in the directories field. This is needed to support the common practice of stripping all but the line number sections (.debug_line and .debug_line_str) from an executable.

This is a bit more involved, since, it needs to compare the translation unit's directory with the DWARF-5 .debug_line section's include_directories[0] entry, and when equal, jettison the latter, keeping the file indices.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 12:37):

ggreif edited a comment on Issue #1988:

Alternatively we could honour this commentary from the DWARF-5 standard:

Prior to DWARF Version 5, the current directory was not represented in the directories field and a directory index of 0 implicitly referred to that directory as found in the DW_AT_comp_dir attribute of the compilation unit debugging information entry. In DWARF Version 5, the current directory is explicitly present in the directories field. This is needed to support the common practice of stripping all but the line number sections (.debug_line and .debug_line_str) from an executable.

This is a bit more involved, since it needs to compare the translation unit's directory with the DWARF-5 .debug_line section's include_directories[0] entry, and when equal, jettison the latter, keeping the file indices.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 16:20):

yurydelendik closed Issue #1988:

For a DWARF-5 equipped .wasm file, translated to .o (via wasmtime wasm2obj -g) the containing directories are mixed up:

.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x000288fa
         version: 5
...
include_directories[  0] = "."
include_directories[  1] = "<moc-asset>"
include_directories[  2] = "tests/debug/testsuite"
file_names[  0]:
           name: "fib-wasm.mo"
      dir_index: 2
file_names[  1]:
.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x0000e747
         version: 4
...
include_directories[  1] = "."
include_directories[  2] = "<moc-asset>"
include_directories[  3] = "tests/debug/testsuite"
file_names[  1]:
           name: "fib-wasm.mo"
      dir_index: 2

Since the latter is one-based, the index must be incremented.

(I'm working on a PR.)


Last updated: Dec 23 2024 at 12:05 UTC