Madushan
Madushan

Reputation: 912

Skip library function in arm assembly GDB

I need to debug this part of arm assembly code,

for3:
ldrb r3,[r4,#0]
ldr r0,=format2
mov r1,r3
bl printf
add r4,r4,#1
cmp r3,#'\0'
bne for3

It contain a printf statement from c, when I debug it goes trough printf code for hundreds of lines. I need to skip external library functions and go through only my code. How to do that?

Upvotes: 1

Views: 1118

Answers (3)

dbrank0
dbrank0

Reputation: 9476

While finish does the trick (once you entered the function), if you need to do this repeatedly, also look into gdb's skip command.

Upvotes: 2

Igor Skochinsky
Igor Skochinsky

Reputation: 25308

Use ni (nexti) instead of si to step over function calls:

nexti
nexti arg
ni

Execute one machine instruction, but if it is a function call, proceed until the function returns. An argument is a repeat count, as in next.

Upvotes: 3

user149341
user149341

Reputation:

Use the finish command in GDB to have the application continue until it returns from the current stack frame. (It can be abbreviated as fin.)

Upvotes: 2

Related Questions