2 years ago

#61532

test-img

peregrinus

gdb does not jump to main

I have been using remote gdb debugging on ARM Cortex A8 for months without any problem. Then I changed the init command in order to debug some memory leak from

set sysroot <path>

to

set sysroot <path>
set pagination off
set breakpoint pending on
set logging file gdbcmd1.out
set logging on
hbreak malloc
commands
set $mallocsize = (unsigned long long) $rdi
continue
end
hbreak *(malloc+191)
commands
printf "malloc(%lld) = 0x%016llx\n", $mallocsize, $rax
continue
end
hbreak free
commands
printf "free(0x%016llx)\n", (unsigned long long) $rdi
continue
end
continue

After this operation I was unable to debug. gdb connects to remote target, but it looks like it does not increment the PC and it does not break at main().

I restored the previous init command but the problem persists, it looks like something has been corrupted.

This the gdb console:

Type "apropos word" to search for commands related to "word".
(gdb) 0xb6fcea00 in ?? ()
Quit
(gdb) break main
Note: breakpoint 24 also set at pc 0x29896.
Breakpoint 25 at 0x29896: file source/main.c, line 326.
(gdb) next
Cannot find bounds of current function
(gdb)

Obviously, when I launch the binary without gdb it works.

gdb

remote-debugging

gdbserver

0 Answers

Your Answer

Accepted video resources