!!! Nobody can read the dwarf specification and write the dwarf parser without hacking the binutils lab. Dwarf is just too complex and lots of algorithms in it. Now i can use peter-dwarf to parse out my c++ kernel. The dwarf stub that generated by c++ is *MUCH* more complex the c.
https://sourceforge.net/p/peter-dwarf/code/358/
fixed these three big bugs:
1. handle zero terminator
if (length == 0) {
System.out.printf(“\n%x ZERO terminator\n\n”, saved_start – start);
ontinue;
}
2. loop shit bytes before real loop, dwarf.java, line 331
3. comment out wrong position code:
int oldPosition = eh_frame_bytes.position();
for (int z = 0; z < augmentationDataLength; z++) {
augmentationData[z] = eh_frame_bytes.get();
//System.out.printf("%x ", augmentationData[z]);
}
/eh_frame_bytes.position(oldPosition);