Re: [Dwarf-Discuss] File name encoding in DWARF

2019-11-27 Thread Robinson, Paul via Dwarf-Discuss
> I am trying to consume the file name of a compile unit. Fortunately
> DW_TAG_compile_unit has a member DW_AT_name and DW_AT_comp_dir.
> Unfortunately it is not clear which kind of encoding is used to
> store these strings. I tried around with GCC and clang. GCC under
> Windows produces latin1 encoding and clang produces UTF-8. I have
> not found any information inside the DWARF debug info on the type
> of encoding used. Is there a way to determine which encoding was
> used? Otherwise, searching for the file on disk can become a
> problem.

DWARF version 3 added the DW_AT_use_UTF8 flag on the compilation
unit to indicate that strings are encoded with UTF-8.  If the flag
is present, you can assume all strings are UTF-8.  Unfortunately,
in the absence of that flag, there is no specified encoding.
DWARF version 5 strongly recommends UTF-8 but does not require it.
--paulr

___
Dwarf-Discuss mailing list
Dwarf-Discuss@lists.dwarfstd.org
http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org


[Dwarf-Discuss] File name encoding in DWARF

2019-11-27 Thread Jayvee Neumann via Dwarf-Discuss
Hello together,

I am trying to consume the file name of a compile unit. Fortunately
DW_TAG_compile_unit has a member DW_AT_name and DW_AT_comp_dir.
Unfortunately it is not clear which kind of encoding is used to store these
strings. I tried around with GCC and clang. GCC under Windows produces
latin1 encoding and clang produces UTF-8. I have not found any information
inside the DWARF debug info on the type of encoding used. Is there a way to
determine which encoding was used? Otherwise, searching for the file on
disk can become a problem.

Kind regards,
Jayvee
___
Dwarf-Discuss mailing list
Dwarf-Discuss@lists.dwarfstd.org
http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org