diff --git a/ast/src/parsed/display.rs b/ast/src/parsed/display.rs index 6342b662a0..cf8d6d6cf8 100644 --- a/ast/src/parsed/display.rs +++ b/ast/src/parsed/display.rs @@ -215,13 +215,13 @@ impl Display for DebugDirective { fn fmt(&self, f: &mut Formatter<'_>) -> Result { match self { DebugDirective::File(nr, path, file) => { - write!(f, "debug file {nr} {} {};", quote(path), quote(file)) + write!(f, ".debug file {nr} {} {};", quote(path), quote(file)) } DebugDirective::Loc(file, line, col) => { - write!(f, "debug loc {file} {line} {col};") + write!(f, ".debug loc {file} {line} {col};") } DebugDirective::OriginalInstruction(insn) => { - write!(f, "debug insn \"{insn}\";") + write!(f, ".debug insn \"{insn}\";") } } } diff --git a/parser/src/powdr.lalrpop b/parser/src/powdr.lalrpop index f18f248115..8d4e85c8f4 100644 --- a/parser/src/powdr.lalrpop +++ b/parser/src/powdr.lalrpop @@ -343,11 +343,11 @@ InstructionStatement: FunctionStatement = { } DebugDirectiveStatement: FunctionStatement = { - "debug" "file" ";" + ".debug" "file" ";" => FunctionStatement::DebugDirective(ctx.source_ref(start), DebugDirective::File(n.try_into().unwrap(), d, f)), - "debug" "loc" ";" + ".debug" "loc" ";" => FunctionStatement::DebugDirective(ctx.source_ref(start), DebugDirective::Loc(f.try_into().unwrap(), line.try_into().unwrap(), col.try_into().unwrap())), - "debug" "insn" ";" + ".debug" "insn" ";" => FunctionStatement::DebugDirective(ctx.source_ref(start), DebugDirective::OriginalInstruction(insn)), } diff --git a/riscv/src/compiler.rs b/riscv/src/compiler.rs index 43c7cec228..cf007ab352 100644 --- a/riscv/src/compiler.rs +++ b/riscv/src/compiler.rs @@ -196,7 +196,7 @@ pub fn compile( let program: Vec = file_ids .into_iter() - .map(|(id, dir, file)| format!("debug file {id} {} {};", quote(&dir), quote(&file))) + .map(|(id, dir, file)| format!(".debug file {id} {} {};", quote(&dir), quote(&file))) .chain(bootloader_lines) .chain(["call __data_init;".to_string()]) .chain([ @@ -814,7 +814,7 @@ fn process_statement(s: Statement, coprocessors: &CoProcessors) -> Vec { ".loc", [Argument::Expression(Expression::Number(file)), Argument::Expression(Expression::Number(line)), Argument::Expression(Expression::Number(column)), ..], ) => { - vec![format!(" debug loc {file} {line} {column};")] + vec![format!(" .debug loc {file} {line} {column};")] } (".file", _) => { // We ignore ".file" directives because they have been extracted to the top.