Implementation of the transition, dwarf

Im working on a source level debugger. Debug information is available in elf format. How can one step over? The problem is in "Point1", anyway, I can wait for the next line of the source (reading from the table .debug_line).

thank

if (a == 1)
 x = 1; //Point1
else if (a == 2)
 x = 1;

z = 1;
+3
source share
1 answer

I'm not sure I fully understand this question, but I can say how GDB implements the team step.

After the control has entered a specific compilation unit, GDB reads this CU debugging information; in particular, it reads the CU part of the .debug_line section and builds a table that displays the addresses of commands in the position of the source code.

step, GDB . , , . , step.

— — , . , , , step .

, , , :

int fact(n) { if (n > 0) { return n * fact(n-1); } else return 1; }

, , . , , , , . :

fact (n=10) at recurse.c:4
(gdb) step
fact (n=9) at recurse.c:4
(gdb) step
fact (n=8) at recurse.c:4

GDB next . , , ; .

, ( DWARF ). .

, , Apple , lldb, .

+4

Source: https://habr.com/ru/post/1754117/


All Articles