* [compile] Relocate memcpy
@ 2018-01-24 12:23 Yao Qi
2018-01-24 13:23 ` Jan Kratochvil
0 siblings, 1 reply; 2+ messages in thread
From: Yao Qi @ 2018-01-24 12:23 UTC (permalink / raw)
To: gdb
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 (齐尧)
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [compile] Relocate memcpy
2018-01-24 12:23 [compile] Relocate memcpy Yao Qi
@ 2018-01-24 13:23 ` Jan Kratochvil
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kratochvil @ 2018-01-24 13:23 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb
On Wed, 24 Jan 2018 13:23:14 +0100, Yao Qi wrote:
> 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.
gdb/compile/compile-object-load.c contains something like ld.so - it loads
object (.o) files and processes their relocations (rather bfd/ does that) to
copy them to mmap()ed areas. I was debugging it only on i686+x86_64.
Jan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-24 13:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24 12:23 [compile] Relocate memcpy Yao Qi
2018-01-24 13:23 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox