gcc can’t handle too much #if macro

gcc can’t handle too much #if macro

2015/08/02 Debugger 1

gcc can’t handle too much macro (#if, #define), the output dwarf will have wrong line number. So when you disassemble the assembly with c/c++ source, everything are wrong, including wrong line number, wrong assembly code to c source code, duplicated c/c++ line.

https://github.com/gcc-mirror/gcc/blob/master/libgcc/libgcc2.c

wrong dwarf produced by gcc

wrong dwarf produced by gcc

 

The decoded lines are out of order

The decoded lines are out of order

In GKD, i add an on/off button to filter out those out of order source, i can’t prove it must be correct but it makes the assembly code more reasonable.

filter out of order c source

filter out of order c source