This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
[compile] Relocate memcpy
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb at sourceware dot org
- Date: Wed, 24 Jan 2018 12:23:14 +0000
- Subject: [compile] Relocate memcpy
- Authentication-results: sourceware.org; auth=none
I triage the fails in gdb.compile on arm-linux,
(gdb) compile code -- ;
(gdb) compile print vararray
Program received signal SIGILL, Illegal instruction.
0xf77eb01c in _gdb_expr (__regs=0xf77ea000, __gdb_out_param=0xf77e9000) at gdb command line:3
3 gdb command line: No such file or directory.
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(_gdb_expr) will be abandoned.
the code in the inferior is,
0xf77eb016 <+22>: f9 68 ldr r1, [r7, #12]
0xf77eb018 <+24>: 38 68 ldr r0, [r7, #0]
0xf77eb01a <+26>: 52 dd ble.n 0xf77eb0c2
=> 0xf77eb01c <+28>: f4 ff 00 bf ; <UNDEFINED> instruction: 0xfff4bf00
0xf77eb020 <+32>: 10 37 adds r7, #16
0xf77eb022 <+34>: bd 46 mov sp, r7
0xf77eb024 <+36>: 80 bd pop {r7, pc}
and the code in object file is (output from objdump)
16: 68f9 ldr r1, [r7, #12]
18: 6838 ldr r0, [r7, #0]
1a: f7ff fffe bl 0 <memcpy>
1e: bf00 nop
20: 3710 adds r7, #16
22: 46bd mov sp, r7
24: bd80 pop {r7, pc}
Looks the instruction "bl memcpy" is patched incorrectly. Can anyone
help me to find which part I should dig it deeper?
I do "set debug compile 1", and see the log,
allocated 0x26 bytes at 0xf77eb000 prot 5
ELF mst_text symbol "memcpy" relocated to 0xf76b7ac0
allocated 0x1 bytes at 0xf77ea000 for registers
allocated 0x14 bytes at 0xf77e9000 for printed value
(gdb) p memcpy
$1 = {<text variable, no debug info>} 0xf76b7ac0 <memcpy>
My understanding is some thing patches "bl memcpy" with the address told
by gdb. I don't know the patching is done by libcc1 or something else.
Note that I post my question here instead of gcc@gcc.gnu.org because
libcc1 is used by gdb, and was done by gdb people.
--
Yao (齐尧)