swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.5k stars 10.35k forks source link

[SR-1643] Struct parameters missing from dSYM in optimized code #44252

Open swift-ci opened 8 years ago

swift-ci commented 8 years ago
Previous ID SR-1643
Radar rdar://26559945
Original Reporter eladcon (JIRA User)
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 1 | |Component/s | Compiler | |Labels | Bug, DebugInfo | |Assignee | @adrian-prantl | |Priority | Medium | md5: cb64af5bc6213df71665eb255e267aea

Issue Description:

Hi,

When building a swift project with Release configuration, struct/array parameters are sometimes missing from the dSYM.

For example, this code:

public class Test {
public func TestArr(intParam: [Int]) {
}
}

Produces this output:

....
0x00000000: Compile Unit: length = 0x00000429 version = 0x0003 abbr_offset = 0x00000000 addr_size = 0x04 (next CU at 0x0000042d)

0x0000000b: TAG_compile_unit [1] *
AT_producer( "Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.31)" )
AT_language( DW_LANG_Swift )
AT_name( "/tmp/DsymTest/DsymTest/ViewController.swift" )
AT_stmt_list( 0x00000000 )
AT_comp_dir( "/private/tmp/DsymTest" )
AT_APPLE_optimized( 0x01 )
....
0x00000554: TAG_structure_type [25] *
AT_name( "Test" )
AT_declaration( 0x01 )
AT_APPLE_runtime_class( 0x1e )

0x0000055b: TAG_subprogram [43]
AT_low_pc( 0x0000a1f4 )
AT_high_pc( 0x0000a1f8 )
AT_frame_base( r7 )
AT_MIPS_linkage_name( "TFC8DsymTest4Test7TestArrfGSaSi_T" )
AT_name( "TestArr" )
AT_decl_file( "/private/tmp/com.apple.launchd.8t3BKDu7fZ/File.swift" )
AT_decl_line( 12 )
AT_type( {0x00000464} ( TtT ) )
AT_external( 0x01 )
AT_APPLE_optimized( 0x01 )
AT_APPLE_isa( 0x02 )

0x00000577: NULL

0x00000578: TAG_subprogram [26]
AT_MIPS_linkage_name( "_TMaC8DsymTest4Test" )
AT_artificial( 0x01 )
AT_external( 0x01 )
AT_APPLE_optimized( 0x01 )
AT_APPLE_isa( 0x02 )
AT_inline( DW_INL_inlined )
.......

belkadan commented 8 years ago

@adrian-prantl, you had a dup of this, right?

adrian-prantl commented 8 years ago

This only happens in optimized code.

Note that this is a deficiency in LLVM, not in the swift frontend. Here is the IR generated for this input:

; Function Attrs: nounwind
define void @TFC3out4Test7TestArrfT8intParamGSaSiT(%swift.bridge*, %C3out4Test* nocapture readnone) #1 35 {
entry:
tail call void @swift_bridgeObjectRelease(%swift.bridge* %0) #8, 45
tail call void @llvm.dbg.value(metadata %swift.bridge* %0, i64 0, metadata ![](46, metadata )47), 48
ret void, 49
}