Skip to content

Commit c76c269

Browse files
committed
Reduce debuginfo divergence between cg_llvm and cg_clif
1 parent 09ec683 commit c76c269

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/debuginfo/mod.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,25 @@ impl DebugContext {
142142
let entry_id = self.dwarf.unit.add(scope, gimli::DW_TAG_subprogram);
143143
let entry = self.dwarf.unit.get_mut(entry_id);
144144
let name_id = self.dwarf.strings.add(name);
145-
// Gdb requires DW_AT_name. Otherwise the DW_TAG_subprogram is skipped.
146-
entry.set(gimli::DW_AT_name, AttributeValue::StringRef(name_id));
147-
entry.set(gimli::DW_AT_linkage_name, AttributeValue::StringRef(name_id));
145+
146+
// These will be replaced in FunctionDebugContext::finalize. They are
147+
// only defined here to ensure that the order of the attributes matches
148+
// rustc.
149+
entry.set(gimli::DW_AT_low_pc, AttributeValue::Udata(0));
150+
entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(0));
148151

149152
let mut frame_base_expr = Expression::new();
150153
frame_base_expr.op_reg(self.stack_pointer_register);
151154
entry.set(gimli::DW_AT_frame_base, AttributeValue::Exprloc(frame_base_expr));
152155

156+
// Gdb requires DW_AT_name. Otherwise the DW_TAG_subprogram is skipped.
157+
// FIXME only include the function name and not the full mangled symbol
158+
entry.set(gimli::DW_AT_name, AttributeValue::StringRef(name_id));
159+
153160
entry.set(gimli::DW_AT_decl_file, AttributeValue::FileIndex(Some(file_id)));
154161
entry.set(gimli::DW_AT_decl_line, AttributeValue::Udata(line));
155-
entry.set(gimli::DW_AT_decl_column, AttributeValue::Udata(column));
162+
163+
// FIXME set DW_AT_external as appropriate
156164

157165
FunctionDebugContext {
158166
entry_id,

0 commit comments

Comments
 (0)