From: Yao Qi <qiyaoltc@gmail.com>
To: gdb@sourceware.org
Subject: [compile] Relocate memcpy
Date: Wed, 24 Jan 2018 12:23:00 -0000 [thread overview]
Message-ID: <868tcne98t.fsf@gmail.com> (raw)
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 (齐尧)
next reply other threads:[~2018-01-24 12:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 12:23 Yao Qi [this message]
2018-01-24 13:23 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=868tcne98t.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox