-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
I'm reporting this here since I've seen symbolication being discussed in this issue tracker.
DWARF debugging information generated for Android builds contains logical file paths, either prefixed by dart: or package:, followed by the package and finally the source path. For example, this is extracted using dwarfdump from an example app:
0x00000650: DW_TAG_subprogram
DW_AT_name ("_IntListMixin.contains")
DW_AT_decl_file ("dart:typed_data-patch/typed_data_patch.dart")
0x0000066b: DW_TAG_subprogram
DW_AT_name ("_RawMaterialButtonState.didUpdateWidget")
DW_AT_decl_file ("package:flutter/src/material/button.dart")
This way of representing files makes sense to a developer, as it clearly states where the file belongs to and how it can be located. However, it is hard for a general-purpose debugger to locate these files, as it usually has no concept of "packages".
Usually, paths like the one referred to by DW_AT_decl_file are relative to a location called the "compilation directory". This is the location in which the compiler was invoked, and is often also considered the "project root". It is defined on the compilation unit, which in our case looks like this:
0x0000000b: DW_TAG_compile_unit
DW_AT_name ("kad")
DW_AT_producer ("Dart VM")
DW_AT_comp_dir ("")
DW_AT_low_pc (0x0000000000010000)
DW_AT_high_pc (0x0000000000259188)
DW_AT_stmt_list (0x00000000)
It would be great to follow DWARF conventions and allow debuggers to locate source files by emitting absolute file paths. This would allow to step through code while debugging, and crash reporting tools like Sentry could attach source code to their crash reports. A possible approach to this would be:
- Set
DW_AT_comp_dirto the project's root folder - Make file locations in
debug_infoanddebug_linesrelative to the compilation dir if they are in the directory - For files outside of the project directory, use absolute locations instead.
It is still possible to retain custom paths by adding an extension to DWARF line programs after DW_LNCT_MD5. Please let me know if I should elaborate on this point.