Aha, looks like you found the right process:
Looking more closely at /usr/bin/gcc:
$ objdump -d /usr/bin/gcc
[...]
a606: f7fe eff6 blx 95f4 <error-0x2fc>
a60a: 1963 adds r3, r4, r5
a60c: f813 2c01 ldrb.w r2, [r3, #-1]
a610: 2a2f cmp r2, #47 ; 0x2f
a612: d003 beq.n a61c <error+0xd2c>
a614: 3301 adds r3, #1
a616: 222f movs r2, #47 ; 0x2f
a618: f805 2036 strb.w r2, [r5, r6, lsl #3]
a61c: 461a mov r2, r3
a61e: 212e movs r1, #46 ; 0x2e
a620: f802 1b01 strb.w r1, [r2], #1
a624: 2100 movs r1, #0
a626: 7059 strb r1, [r3, #1]
a628: f1b8 0f00 cmp.w r8, #0
a62c: d002 beq.n a634 <error+0xd44>
a62e: 7823 ldrb r3, [r4, #0]
a630: 2b2f cmp r3, #47 ; 0x2f
a632: d013 beq.n a65c <error+0xd6c>
a634: 2003 movs r0, #3
a636: 4621 mov r1, r4
a638: 463a mov r2, r7
a63a: f7fe ef04 blx 9444 <error-0x4ac>
[...]
Oddly, there are no instructions in this sequence which should be causing
alignment faults (as already appeared to be the case).
One thing you could try is to remove the problem instructions and emulate
them in gdb.
$ cp /usr/bin/gcc ~
#Use a hex editor (hexedit works well) to fill the bytes at file offsets
0x2628..0x262d and 0x2630..0x2631 with nops (0x00, 0xBF)
#the binary should now look like this:
...
00002620 02 f8 01 1b 00 21 59 70 00 bf 00 bf 00 bf 23 78
|.....!Yp......#x|
00002630 00 bf 13 d0 03 20 21 46 3a 46 fe f7 04 ef 00 28 |.....
!F:F.....(|
...
(The modified bytes correspond to the faulting instructions at 0xa628...
assuming your binary is still the same as mine.)
The attached GDB script contains some macro magic which breaks on the NOPs
and emulates the effect of the instructions instead using GDB commands.
I tested it by compiling a silly C program:
$ cat <<EOF >hello.c
#include <stdio.h>
int main(void)
{
char name[80];
fputs("Hello, what's your name? ", stderr);
fgets(name, sizeof name, stdin);
printf("Hello, %s", name);
return 0;
}
EOF
$ gdb -x gdbscript.txt --args ~/gcc -B/usr/lib/gcc/arm-linux-gnueabi/4.4.3
-O99 -o hello hello.c
(The -B argument tells gcc where its brain is... the default location search
is relative to the location of the gcc binary and didn't work for me since
my copy is in a different place from the installed one.)
This appeared to run correctly for me, creating a working output file. See
gdb.log.
(You can type "set $nostop=1" in GDB before continuing to stop breaking on
every emulated instruction.)
It would be interesting to see whether this works for you, or whether you
still get faults or other bad things happening...
** Attachment added: "gdbscript.txt"
http://launchpadlibrarian.net/38444584/gdbscript.txt
** Attachment added: "gdb.log"
http://launchpadlibrarian.net/38444585/gdb.log
--
fakeroot Illegal instruction in lucid armv7 on the beagleboard
https://bugs.launchpad.net/bugs/495536
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs