I guess you'll compile the generated C with debug info (-g), so what you're asking is how to have additional DWARF records that describe your high level language. Conceivable approaches:
(1) edit the object file to augment the DWARF records for the C code. I don't know of an existing tool, perhaps doable with libdwarf or pyelftools.
(2) find a way to "smuggle" extra DWARF records through the compiler, e.g. somewhat as linker commands can be given through #pragmas. However I don't know of a compiler that supports this.
(3) LLVM has support for debug records in the IR representation . You could use clang to compile your generated C to IR (clang foo.c -S -emit-llvm -target arm -o foo.ll
), then augment foo.ll, then generate the .o (llc foo.ll
), ready for linking.
The third option seems likely to be the easiest.