I have been trying to find a way for some time to automate the progress in GDB of tracing the control flow of a program.
Even just a simple way of automating the n
command so you can see in what order routines are called.
I realise that you can issues n x
where x is the number of times GDB steps through, but the trouble with that is that it shows the command but not the address of the routine! But if you press n
manually in GDB (then press return to issue the previous command) it shows the address.
I have tried the following in GDB:
(after setting a breakpoint at say 0x0123456)
b *0x0123456
GDB says <breakpoint 1 at 0x123456>
. I type:
commands 1
n 1000
c
end
but it doesn't loop as expected, and it doesn't show the address location :-(.
Any help would be appreciated! Surely it must be simple to automatically log the order routines are called??
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…