@@ -43,7 +43,7 @@ pub(crate) struct FunctionDebugContext {
4343}
4444
4545impl DebugContext {
46- pub ( crate ) fn new ( tcx : TyCtxt < ' _ > , isa : & dyn TargetIsa ) -> Self {
46+ pub ( crate ) fn new ( tcx : TyCtxt < ' _ > , isa : & dyn TargetIsa , cgu_name : & str ) -> Self {
4747 let encoding = Encoding {
4848 format : Format :: Dwarf32 ,
4949 // FIXME this should be configurable
@@ -108,14 +108,20 @@ impl DebugContext {
108108 dwarf. unit . line_program = line_program;
109109
110110 {
111- let name = dwarf. strings . add ( name) ;
111+ let name = dwarf. strings . add ( format ! ( "{ name}/@/{cgu_name}" ) ) ;
112112 let comp_dir = dwarf. strings . add ( comp_dir) ;
113113
114114 let root = dwarf. unit . root ( ) ;
115115 let root = dwarf. unit . get_mut ( root) ;
116116 root. set ( gimli:: DW_AT_producer , AttributeValue :: StringRef ( dwarf. strings . add ( producer) ) ) ;
117117 root. set ( gimli:: DW_AT_language , AttributeValue :: Language ( gimli:: DW_LANG_Rust ) ) ;
118118 root. set ( gimli:: DW_AT_name , AttributeValue :: StringRef ( name) ) ;
119+
120+ // This will be replaced when emitting the debuginfo. It is only
121+ // defined here to ensure that the order of the attributes matches
122+ // rustc.
123+ root. set ( gimli:: DW_AT_stmt_list , AttributeValue :: Udata ( 0 ) ) ;
124+
119125 root. set ( gimli:: DW_AT_comp_dir , AttributeValue :: StringRef ( comp_dir) ) ;
120126 root. set ( gimli:: DW_AT_low_pc , AttributeValue :: Address ( Address :: Constant ( 0 ) ) ) ;
121127 }
0 commit comments