This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb disassemble shift about 52 bytes in arm platform


----- Original Message ----- 
From: "Andrew Lunn" <andrew@lunn.ch>
To: "Frank Lin" <franklin373@gmail.com>
Cc: <ecos-discuss@ecos.sourceware.org>
Sent: Monday, April 28, 2008 4:49 PM
Subject: Re: [ECOS] gdb disassemble shift about 52 bytes in arm platform


> On Mon, Apr 28, 2008 at 03:33:51PM +0800, Frank Lin wrote:
>> My Global compiler flags is: -mcpu=arm7tdmi -mno-short-load-words -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O0 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority
>> My Global linker flags is: -mcpu=arm7tdmi -mno-short-load-words -Wl,--gc-sections -Wl,-static -g -nostdlib
>> 
>> for example:
>> 
>> I disassmble do_mfill function in mfill.c using elf-arm-insight in mixed mode(using elf-arm-gdb is same result, but elf-arm-insight more clearly), it display(please pay attention I mark with '<---------'):
>> 
> 
> I've not had problems before. Are you sure everything is syncronised?

Yes, everything is syncronised.


> What is on your hardware is the same as the object file on your host
> and that the objects are from your current sources?

I use S3C44B0X CPU, the objects is from current souces.

> 
> Try arm-elf-objdump -D myprog.elf | less
> 
> and see if there is the same problem. This removes the target from the
> picture.

I use arm-elf-objdump -D redboot.elf, the result is correct, for example:

00003108 <do_mfill>:
    3108: e1a0c00d  mov ip, sp
    310c: e92dd800  stmdb sp!, {fp, ip, lr, pc}
    3110: e24cb004  sub fp, ip, #4 ; 0x4
    3114: e24dd0cc  sub sp, sp, #204 ; 0xcc
    3118: e50b0010  str r0, [fp, -#16]
    311c: e50b1014  str r1, [fp, -#20]
    3120: e24b20a4  sub r2, fp, #164 ; 0xa4
    3124: e24b30a8  sub r3, fp, #168 ; 0xa8
    3128: e58d3000  str r3, [sp]
    312c: e24b30b4  sub r3, fp, #180 ; 0xb4
    3130: e58d3004  str r3, [sp, #4]
    3134: e59f3244  ldr r3, [pc, #580] ; 3380 <do_mfill+0x278>
    3138: e58d3008  str r3, [sp, #8]
    313c: e1a00002  mov r0, r2
    3140: e3a01062  mov r1, #98 ; 0x62
    3144: e3a02001  mov r2, #1 ; 0x1
    3148: e3a03000  mov r3, #0 ; 0x0
    314c: eb002bf5  bl e128 <init_opts>
    3150: e24b30a4  sub r3, fp, #164 ; 0xa4
    3154: e2832018  add r2, r3, #24 ; 0x18
    3158: e24b30b0  sub r3, fp, #176 ; 0xb0
    315c: e58d3000  str r3, [sp]
    3160: e24b30b8  sub r3, fp, #184 ; 0xb8
    3164: e58d3004  str r3, [sp, #4]
    3168: e59f3214  ldr r3, [pc, #532] ; 3384 <do_mfill+0x27c>
    316c: e58d3008  str r3, [sp, #8]
    3170: e1a00002  mov r0, r2
    3174: e3a0106c  mov r1, #108 ; 0x6c
    3178: e3a02001  mov r2, #1 ; 0x1
    317c: e3a03000  mov r3, #0 ; 0x0
    3180: eb002be8  bl e128 <init_opts>
    3184: e24b30a4  sub r3, fp, #164 ; 0xa4
    3188: e2832030  add r2, r3, #48 ; 0x30
    318c: e24b30ac  sub r3, fp, #172 ; 0xac
    3190: e58d3000  str r3, [sp]
    3194: e24b30bc  sub r3, fp, #188 ; 0xbc
    3198: e58d3004  str r3, [sp, #4]
    319c: e59f31e4  ldr r3, [pc, #484] ; 3388 <do_mfill+0x280>
    31a0: e58d3008  str r3, [sp, #8]
    31a4: e1a00002  mov r0, r2
    31a8: e3a01070  mov r1, #112 ; 0x70
    31ac: e3a02001  mov r2, #1 ; 0x1
    31b0: e3a03000  mov r3, #0 ; 0x0
    31b4: eb002bdb  bl e128 <init_opts>
    31b8: e24b30a4  sub r3, fp, #164 ; 0xa4
    31bc: e2832048  add r2, r3, #72 ; 0x48
    31c0: e24b30c0  sub r3, fp, #192 ; 0xc0
    31c4: e58d3000  str r3, [sp]
    31c8: e3a03000  mov r3, #0 ; 0x0
    31cc: e58d3004  str r3, [sp, #4]
    31d0: e59f31b4  ldr r3, [pc, #436] ; 338c <do_mfill+0x284>
    31d4: e58d3008  str r3, [sp, #8]
    31d8: e1a00002  mov r0, r2
    31dc: e3a01034  mov r1, #52 ; 0x34
    31e0: e3a02000  mov r2, #0 ; 0x0
    31e4: e3a03002  mov r3, #2 ; 0x2
    31e8: eb002bce  bl e128 <init_opts>
    31ec: e24b30a4  sub r3, fp, #164 ; 0xa4
    31f0: e2832060  add r2, r3, #96 ; 0x60
    31f4: e24b30c4  sub r3, fp, #196 ; 0xc4
    31f8: e58d3000  str r3, [sp]
    31fc: e3a03000  mov r3, #0 ; 0x0
    3200: e58d3004  str r3, [sp, #4]
    3204: e59f3184  ldr r3, [pc, #388] ; 3390 <do_mfill+0x288>
    3208: e58d3008  str r3, [sp, #8]
    320c: e1a00002  mov r0, r2
    3210: e3a01032  mov r1, #50 ; 0x32
    3214: e3a02000  mov r2, #0 ; 0x0
    3218: e3a03002  mov r3, #2 ; 0x2
    321c: eb002bc1  bl e128 <init_opts>
    3220: e24b30a4  sub r3, fp, #164 ; 0xa4
    3224: e2832078  add r2, r3, #120 ; 0x78
    3228: e24b30c8  sub r3, fp, #200 ; 0xc8
    322c: e58d3000  str r3, [sp]
    3230: e3a03000  mov r3, #0 ; 0x0
    3234: e58d3004  str r3, [sp, #4]
    3238: e59f3154  ldr r3, [pc, #340] ; 3394 <do_mfill+0x28c>
    323c: e58d3008  str r3, [sp, #8]
    3240: e1a00002  mov r0, r2
    3244: e3a01031  mov r1, #49 ; 0x31
    3248: e3a02000  mov r2, #0 ; 0x0
    324c: e3a03002  mov r3, #2 ; 0x2
    3250: eb002bb4  bl e128 <init_opts>
    3254: e24bc0a4  sub ip, fp, #164 ; 0xa4
    3258: e3a03006  mov r3, #6 ; 0x6
    325c: e58d3000  str r3, [sp]
    3260: e3a03000  mov r3, #0 ; 0x0
    3264: e58d3004  str r3, [sp, #4]
    3268: e3a03000  mov r3, #0 ; 0x0
    326c: e58d3008  str r3, [sp, #8]
    3270: e59f3120  ldr r3, [pc, #288] ; 3398 <do_mfill+0x290>
    3274: e58d300c  str r3, [sp, #12]
    3278: e51b0010  ldr r0, [fp, -#16]
    327c: e51b1014  ldr r1, [fp, -#20]
    3280: e3a02001  mov r2, #1 ; 0x1
    3284: e1a0300c  mov r3, ip
    3288: eb002bc2  bl e198 <scan_opts>
    328c: e1a03000  mov r3, r0
    3290: e3530000  cmp r3, #0 ; 0x0
    3294: 1a000000  bne 329c <do_mfill+0x194>
    3298: ea000037  b 337c <do_mfill+0x274>
    329c: e51b30b4  ldr r3, [fp, -#180]
    32a0: e3530000  cmp r3, #0 ; 0x0
    32a4: 0a000002  beq 32b4 <do_mfill+0x1ac>
    32a8: e51b30b8  ldr r3, [fp, -#184]
    32ac: e3530000  cmp r3, #0 ; 0x0
    32b0: 1a000002  bne 32c0 <do_mfill+0x1b8>
    32b4: e59f00e0  ldr r0, [pc, #224] ; 339c <do_mfill+0x294>
    32b8: eb00203b  bl b3ac <diag_printf>
    32bc: ea00002e  b 337c <do_mfill+0x274>
    32c0: e51b30bc  ldr r3, [fp, -#188]
    32c4: e3530000  cmp r3, #0 ; 0x0
    32c8: 1a000001  bne 32d4 <do_mfill+0x1cc>
    32cc: e3a03000  mov r3, #0 ; 0x0
    32d0: e50b30ac  str r3, [fp, -#172]
    32d4: e51b30c8  ldr r3, [fp, -#200]
    32d8: e3530000  cmp r3, #0 ; 0x0
    32dc: 0a00000b  beq 3310 <do_mfill+0x208>
    32e0: e51b30b0  ldr r3, [fp, -#176]
    32e4: e2433001  sub r3, r3, #1 ; 0x1
    32e8: e50b30b0  str r3, [fp, -#176]
    32ec: e3530000  cmp r3, #0 ; 0x0
    32f0: aa000000  bge 32f8 <do_mfill+0x1f0>
    32f4: ea000020  b 337c <do_mfill+0x274>
    32f8: e51b30a8  ldr r3, [fp, -#168]
    32fc: e2832001  add r2, r3, #1 ; 0x1
    3300: e50b20a8  str r2, [fp, -#168]
    3304: e55b20ac  ldrb r2, [fp, -#172]
    3308: e5c32000  strb r2, [r3]
    330c: eafffff3  b 32e0 <do_mfill+0x1d8>
    3310: e51b30c4  ldr r3, [fp, -#196]
    3314: e3530000  cmp r3, #0 ; 0x0
    3318: 0a00000b  beq 334c <do_mfill+0x244>
    331c: e51b30b0  ldr r3, [fp, -#176]
    3320: e2433002  sub r3, r3, #2 ; 0x2
    3324: e50b30b0  str r3, [fp, -#176]
    3328: e3530000  cmp r3, #0 ; 0x0
    332c: aa000000  bge 3334 <do_mfill+0x22c>
    3330: ea000011  b 337c <do_mfill+0x274>
    3334: e51b30a8  ldr r3, [fp, -#168]
    3338: e2832002  add r2, r3, #2 ; 0x2
    333c: e50b20a8  str r2, [fp, -#168]
    3340: e15b2abc  ldrh r2, [fp, -#172]
    3344: e1c320b0  strh r2, [r3]
    3348: eafffff3  b 331c <do_mfill+0x214>
    334c: e51b30b0  ldr r3, [fp, -#176]
    3350: e2433004  sub r3, r3, #4 ; 0x4
    3354: e50b30b0  str r3, [fp, -#176]
    3358: e3530000  cmp r3, #0 ; 0x0
    335c: aa000000  bge 3364 <do_mfill+0x25c>
    3360: ea000005  b 337c <do_mfill+0x274>
    3364: e51b30a8  ldr r3, [fp, -#168]
    3368: e2832004  add r2, r3, #4 ; 0x4
    336c: e50b20a8  str r2, [fp, -#168]
    3370: e51b20ac  ldr r2, [fp, -#172]
    3374: e5832000  str r2, [r3]
    3378: eafffff3  b 334c <do_mfill+0x244>
    337c: e91ba800  ldmdb fp, {fp, sp, pc}
    3380: 00019f40  andeq r9, r1, r0, asr #30
    3384: 00019f50  andeq r9, r1, r0, asr pc
    3388: 00019f58  andeq r9, r1, r8, asr pc
    338c: 00019f60  andeq r9, r1, r0, ror #30
    3390: 00019f74  andeq r9, r1, r4, ror pc
    3394: 00019f88  andeq r9, r1, r8, lsl #31
    3398: 00019f9c  muleq r1, ip, pc
    339c: 00019fa0  andeq r9, r1, r0, lsr #31


This image have some small diff with the image in my first mail, for now I compile in my home's computer, but two computer has same error.

My GDB work with JLink GDB Server, and I also let gdb work with ecos's buildin gdb feature throught serial port, result is the same.


> 
>        Andrew

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]