Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Issue 2147523005: Initial support for dumping DWARF corresponding to Swift code (Closed)

Created:
4 years, 5 months ago by Mark Mentovai
Modified:
4 years, 2 months ago
CC:
vapier, eskiman_google.com, google-breakpad-dev_googlegroups.com, haneym
Base URL:
https://chromium.googlesource.com/breakpad/breakpad.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Initial support for dumping DWARF corresponding to Swift code The DWARF data for Swift code has a top-level DW_TAG_module DIE as the child of the DW_TAG_compile_unit DIE and the parent of the DW_TAG_subprogram DIEs that dump_syms uses to locate functions. dump_syms needs to process DW_TAG_module DIEs as introducing nested scopes to make it work with Swift. This also reworks demangling to be language-specific, so that the C++ demangler isn't invoked when processing Swift code. The DWARF data for Swift code presents its mangled names in the same form as used for C++ (DW_AT_MIPS_linkage_name or DW_AT_linkage_name) but the mangling is Swift-specific (beginning with _T instead of _Z). There is no programmatic interface to a Swift name demangler as an analogue to C++'s __cxa_demangle(), so mangled Swift names are exposed as-is. Xcode's "xcrun swift-demangle" can be used to post-process these mangled Swift names on macOS. Support for mangled names presented in a DW_AT_linkage_name attribute, as used by DWARF 4, is added. This supersedes the earlier use of DW_AT_MIPS_linkage_name. BUG=google-breakpad:702, google-breakpad:715 R=ted.mielczarek@gmail.com Committed: https://chromium.googlesource.com/breakpad/breakpad/+/7398ce15b79daf038cd07fbae4e37e183e99788d

Patch Set 1 #

Patch Set 2 : Pass through mangled Swift names; support DWARF 4's DW_AT_linkage_name #

Total comments: 4

Patch Set 3 : Address review feedback #

Total comments: 2

Patch Set 4 : #else #

Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -33 lines) Patch
M src/common/dwarf/dwarf2enums.h View 1 4 chunks +5 lines, -2 lines 0 comments Download
M src/common/dwarf_cu_to_module.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/common/dwarf_cu_to_module.cc View 1 2 5 chunks +24 lines, -21 lines 0 comments Download
M src/common/dwarf_cu_to_module_unittest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/common/language.h View 1 2 1 chunk +16 lines, -0 lines 0 comments Download
M src/common/language.cc View 1 2 3 3 chunks +83 lines, -8 lines 0 comments Download

Messages

Total messages: 24 (10 generated)
Mark Mentovai
Yunlian, you’ve worked on the DWARF reader somewhat recently. Please let me know if you’re ...
4 years, 5 months ago (2016-07-13 18:06:13 UTC) #2
Mark Mentovai
Yunlian is out, but it looks like vapier’s also been in here lately.
4 years, 5 months ago (2016-07-13 20:59:48 UTC) #4
Mark Mentovai
Updated. By request, this now passes mangled Swift names straight through to dump_syms’ output. “xcrun ...
4 years, 3 months ago (2016-09-13 19:33:15 UTC) #8
Ted Mielczarek
On 2016/09/13 19:33:15, Mark Mentovai wrote: > Updated. By request, this now passes mangled Swift ...
4 years, 3 months ago (2016-09-13 19:38:42 UTC) #9
Mark Mentovai
Cool. Although it sounds like we can demangle Rust where __cxa_demangle is available, and require ...
4 years, 3 months ago (2016-09-13 19:41:17 UTC) #11
Ted Mielczarek
On 2016/09/13 19:41:17, Mark Mentovai wrote: > Cool. Although it sounds like we can demangle ...
4 years, 3 months ago (2016-09-13 20:02:35 UTC) #12
vapier
i'm not terribly familiar with the dwarf dumping code, so i'm not the best for ...
4 years, 3 months ago (2016-09-14 05:14:22 UTC) #14
Ted Mielczarek
LGO This was surprisingly not that hard to review considering it's touching DWARF handling code! ...
4 years, 3 months ago (2016-09-14 10:20:10 UTC) #15
Mark Mentovai
Thanks for the review, Ted! I’ve implemented your suggestions. https://codereview.chromium.org/2147523005/diff/20001/src/common/dwarf_cu_to_module.cc File src/common/dwarf_cu_to_module.cc (right): https://codereview.chromium.org/2147523005/diff/20001/src/common/dwarf_cu_to_module.cc#newcode356 src/common/dwarf_cu_to_module.cc:356: ...
4 years, 3 months ago (2016-09-21 17:56:56 UTC) #16
Ted Mielczarek
LGTM with one fix. https://codereview.chromium.org/2147523005/diff/40001/src/common/language.cc File src/common/language.cc (right): https://codereview.chromium.org/2147523005/diff/40001/src/common/language.cc#newcode77 src/common/language.cc:77: #endif You need to wrap ...
4 years, 3 months ago (2016-09-23 14:28:44 UTC) #17
Mark Mentovai
Ted Mielczarek wrote: > LGTM with one fix. > > https://codereview.chromium.org/2147523005/diff/40001/src/common/language.cc > File src/common/language.cc (right): ...
4 years, 3 months ago (2016-09-23 18:22:26 UTC) #19
Mark Mentovai
Committed patchset #4 (id:60001) manually as 7398ce15b79daf038cd07fbae4e37e183e99788d (presubmit successful).
4 years, 3 months ago (2016-09-23 18:22:46 UTC) #21
dawikur
https://codereview.chromium.org/2147523005/diff/40001/src/common/language.cc File src/common/language.cc (right): https://codereview.chromium.org/2147523005/diff/40001/src/common/language.cc#newcode89 src/common/language.cc:89: demangled->assign(demangled_c); It is possible that demangled_c here is nullptr, ...
4 years, 2 months ago (2016-09-26 13:28:03 UTC) #23
Mark Mentovai
4 years, 2 months ago (2016-09-26 13:40:57 UTC) #24
Message was sent while issue was closed.
dawikur wrote:
> https://codereview.chromium.org/2147523005/diff/40001/src/common/language.cc
> File src/common/language.cc (right):
> 
>
https://codereview.chromium.org/2147523005/diff/40001/src/common/language.cc#...
> src/common/language.cc:89: demangled->assign(demangled_c);
> It is possible that demangled_c here is nullptr, which breaks
> std::string::assign contract and is causing SEGFAULT.

I don’t know how I managed to swap the success and failure branches, but
https://chromium-review.googlesource.com/389411 will fix it.

Powered by Google App Engine
This is Rietveld 408576698