gdb에서 libc 함수로 중단할 수 없습니다.

gdb에서 libc 함수로 중단할 수 없습니다.

표적:

gdbserver --wrapper env "LD_PRELOAD=/test.so" -- :1234 /bin/true

디버거:

# gdb-multiarch -ex 'set arc arm' -ex 'target remote :1234'
...
For help, type "help".
Type "apropos word" to search for commands related to "word".
The target architecture is set to "arm".
Remote debugging using :1234
Reading /bin/busybox.nosuid from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /bin/busybox.nosuid from remote target...
Reading symbols from target:/bin/busybox.nosuid...
Reading /bin/.debug/busybox.nosuid from remote target...
Reading /usr/lib/debug//bin/busybox.nosuid from remote target...
Reading /usr/lib/debug/bin//busybox.nosuid from remote target...
Reading target:/usr/lib/debug/bin//busybox.nosuid from remote target...
(No debugging symbols found in target:/bin/busybox.nosuid)
Reading /lib/ld-linux.so.3 from remote target...
Reading /lib/ld-linux.so.3 from remote target...
Reading symbols from target:/lib/ld-linux.so.3...
Reading /lib/ld-2.27.so from remote target...
Reading /lib/.debug/ld-2.27.so from remote target...
Reading /usr/lib/debug//lib/ld-2.27.so from remote target...
Reading /usr/lib/debug/lib//ld-2.27.so from remote target...
Reading target:/usr/lib/debug/lib//ld-2.27.so from remote target...
(No debugging symbols found in target:/lib/ld-linux.so.3)
0x4a490ba0 in ?? () from target:/lib/ld-linux.so.3
(gdb) info sharedlibrary
From        To          Syms Read   Shared Object Library
0x4a4909f0  0x4a4ab644  Yes (*)     target:/lib/ld-linux.so.3
(*): Shared library is missing debugging information.
(gdb) b __read
Function "__read" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (__read) pending.
(gdb) c
Continuing.
Reading /lib/libc.so.6 from remote target...
Reading /run/test.so from remote target...
Reading /lib/libc-2.27.so from remote target...
Reading /lib/.debug/libc-2.27.so from remote target...
Reading /usr/lib/debug//lib/libc-2.27.so from remote target...
Reading /usr/lib/debug/lib//libc-2.27.so from remote target...
Reading target:/usr/lib/debug/lib//libc-2.27.so from remote target...

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) info b
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   <PENDING>  __read+10

libc 및 /bin/true가 제거됩니다.

gdb를 처음 시작할 때 libc가 로드되지 않는 것 같습니다. 따라서 libc의 특정 주소(이름 + 오프셋 기준)에서는 인터럽트가 발생하지 않습니다. 어떻게 해야 합니까?

(gdb) b *0x4a5174e0
Breakpoint 1 at 0x4a5174e0
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x4a5174e0

Command aborted.

로드하기 전에 주소를 중단하면 실행조차 되지 않습니다.

관련 정보