@@ -43,7 +43,7 @@ pub(crate) struct FunctionDebugContext {
43
43
}
44
44
45
45
impl 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 {
47
47
let encoding = Encoding {
48
48
format : Format :: Dwarf32 ,
49
49
// FIXME this should be configurable
@@ -108,14 +108,20 @@ impl DebugContext {
108
108
dwarf. unit . line_program = line_program;
109
109
110
110
{
111
- let name = dwarf. strings . add ( name) ;
111
+ let name = dwarf. strings . add ( format ! ( "{ name}/@/{cgu_name}" ) ) ;
112
112
let comp_dir = dwarf. strings . add ( comp_dir) ;
113
113
114
114
let root = dwarf. unit . root ( ) ;
115
115
let root = dwarf. unit . get_mut ( root) ;
116
116
root. set ( gimli:: DW_AT_producer , AttributeValue :: StringRef ( dwarf. strings . add ( producer) ) ) ;
117
117
root. set ( gimli:: DW_AT_language , AttributeValue :: Language ( gimli:: DW_LANG_Rust ) ) ;
118
118
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
+
119
125
root. set ( gimli:: DW_AT_comp_dir , AttributeValue :: StringRef ( comp_dir) ) ;
120
126
root. set ( gimli:: DW_AT_low_pc , AttributeValue :: Address ( Address :: Constant ( 0 ) ) ) ;
121
127
}
0 commit comments