问题描述
我正在用nasm编写一种汇编级的人类可口编程语言.我注意到,Dwarf调试是开发它的必要组件.
I'm writing an assembly level human speakable programming language in nasm.I've noticed that Dwarf debugging is an essential component to developing it.
为了使其以后能够自托管,不仅必须编译为ELF,而且还支持Dwarf以使调试可行.对于ELF,有一个很棒的nasm示例,说明如何制作ELF标头 http://www.muppetlabs.com/~breadbox/software/tiny/teensy .html http://blog.markloiseau.com/2012/05/tiny-64-bit-elf-executables/
In order for it to become self-hosting later on, will not only have to compile to ELF, but also support Dwarf to make debugging viable.For ELF there is a wonderful nasm example of how to make an ELF headerhttp://www.muppetlabs.com/~breadbox/software/tiny/teensy.htmlhttp://blog.markloiseau.com/2012/05/tiny-64-bit-elf-executables/
我想知道DWARF是否存在甚至可以做成类似的东西,一个示例hello world,其中包括与gdb配合使用所需的DWARF部分.有了这样一个示例,相比于主要涉及C的晦涩的文档,要理解DWARF会容易得多.我找到的最接近的是IBM的指南,其中包含一个小程序,可让您根据每个功能有选择地进行矮化转储www.ibm.com/developerworks/library/os-debugging/
I'm wondering if there is or even could be made something similar for DWARF,an example hello world, that includes the DWARF sections required for it to work with gdb.With such an example it would be much easier to understand DWARF, rather than going through rather cryptic documentation, that mostly refers to C.The closest I've found is a guide by IBM that has a little program that lets you selectively dwarf dump on a per function basiswww.ibm.com/developerworks/library/os-debugging/
无论如何,如果您碰巧能够举一个鼻涕高的世界矮人榜样,我相信全世界都会对此表示赞赏,因为它将使矮化格式更易于使用.也许有人甚至可以用fasm或nasm以外的其他汇编器来实现它.
Anyways if you happen to be able to make a nasm hello world dwarf example,I'm sure the world will much appreciate it, since it will make the dwarf format more accessible. Maybe someone will then even be able to implement it in fasm or other assemblers than nasm.
推荐答案
如果您不介意的话,gdb测试套件中有一个简单的"DWARF汇编器".参见src/gdb/testsuite/lib/dwarf.exp.这很容易理解,尽管它有名字,但它会写出汇编代码.您可以在测试套件的其余部分中进行grep操作,以查看其用法示例.
If you don't mind digging a bit, there is a simple "DWARF assembler" in the gdb test suite. See src/gdb/testsuite/lib/dwarf.exp. It's pretty easy to understand and despite its name it writes out assembly code. You can grep through the rest of the test suite to see examples of how it is used.
这篇关于侏儒你好世界大会的例子还是辅导?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!