* [ECOS] gdb disassemble shift about 52 bytes in arm platform
@ 2008-04-28 11:14 Frank Lin
2008-04-28 13:32 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: Frank Lin @ 2008-04-28 11:14 UTC (permalink / raw)
To: ecos-discuss
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 '<---------'):
66 {
- 0x3108 <do_mfill>: ldr r3, [r11, #-80]
- 0x310c <do_mfill+4>: bl 0xb3e0 <diag_printf+52>
- 0x3110 <do_mfill+8>: ldmdb r11, {r11, sp, pc}
- 0x3114 <do_mfill+12>: streqd r9, [r1], -r8
- 0x3118 <do_mfill+16>: andeq r9, r1, r8, lsl #30
- 0x311c <do_mfill+20>: andeq r9, r1, r0, lsl pc
67 // Fill a region of memory with a pattern
68 struct option_info opts[6];
69 unsigned long base, pat;
70 long len;
71 bool base_set, len_set, pat_set;
72 bool set_32bit, set_16bit, set_8bit;
73
74 init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM,
- 0x3120 <do_mfill+24>: stceq 10, cr13, [r0], {64}
- 0x3124 <do_mfill+28>: stceq 9, cr13, [r0], {96}
- 0x3128 <do_mfill+32>: stceq 9, cr13, [r0], {0}
- 0x312c <do_mfill+36>: stceq 8, cr13, [r0], {160}
- 0x3130 <do_mfill+40>: andeq r9, r1, r4, lsl pc
- 0x3134 <do_mfill+44>: andeq r9, r1, r4, lsr pc
- 0x3138 <do_mfill+48>: andeq r9, r1, r8, asr pc
- 0x313c <do_mfill+52>: mov r12, sp <----------------really do_mfill() function begin
- 0x3140 <do_mfill+56>: stmdb sp!, {r11, r12, lr, pc}
- 0x3144 <do_mfill+60>: sub r11, r12, #4 ; 0x4
- 0x3148 <do_mfill+64>: sub sp, sp, #204 ; 0xcc
- 0x314c <do_mfill+68>: str r0, [r11, #-16]
75 (void **)&base, (bool *)&base_set, "base address");
76 init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM,
- 0x3150 <do_mfill+72>: str r1, [r11, #-20]
- 0x3154 <do_mfill+76>: sub r2, r11, #164 ; 0xa4
- 0x3158 <do_mfill+80>: sub r3, r11, #168 ; 0xa8
- 0x315c <do_mfill+84>: str r3, [sp]
- 0x3160 <do_mfill+88>: sub r3, r11, #180 ; 0xb4
- 0x3164 <do_mfill+92>: str r3, [sp, #4]
- 0x3168 <do_mfill+96>: ldr r3, [pc, #580] ; 0x33b4 <do_mcmp+20>
- 0x316c <do_mfill+100>: str r3, [sp, #8]
- 0x3170 <do_mfill+104>: mov r0, r2
- 0x3174 <do_mfill+108>: mov r1, #98 ; 0x62
- 0x3178 <do_mfill+112>: mov r2, #1 ; 0x1
- 0x317c <do_mfill+116>: mov r3, #0 ; 0x0
- 0x3180 <do_mfill+120>: bl 0xe15c <init_opts+52> <-----------------it calls other func, also shift 52 bytes
77 (void **)&len, (bool *)&len_set, "length");
78 init_opts(&opts[2], 'p', true, OPTION_ARG_TYPE_NUM,
- 0x3184 <do_mfill+124>: sub r3, r11, #164 ; 0xa4
- 0x3188 <do_mfill+128>: add r2, r3, #24 ; 0x18
- 0x318c <do_mfill+132>: sub r3, r11, #176 ; 0xb0
- 0x3190 <do_mfill+136>: str r3, [sp]
- 0x3194 <do_mfill+140>: sub r3, r11, #184 ; 0xb8
- 0x3198 <do_mfill+144>: str r3, [sp, #4]
- 0x319c <do_mfill+148>: ldr r3, [pc, #532] ; 0x33b8 <do_mcmp+24>
- 0x31a0 <do_mfill+152>: str r3, [sp, #8]
- 0x31a4 <do_mfill+156>: mov r0, r2
- 0x31a8 <do_mfill+160>: mov r1, #108 ; 0x6c
- 0x31ac <do_mfill+164>: mov r2, #1 ; 0x1
- 0x31b0 <do_mfill+168>: mov r3, #0 ; 0x0
- 0x31b4 <do_mfill+172>: bl 0xe15c <init_opts+52>
79 (void **)&pat, (bool *)&pat_set, "pattern");
80 init_opts(&opts[3], '4', false, OPTION_ARG_TYPE_FLG,
- 0x31b8 <do_mfill+176>: sub r3, r11, #164 ; 0xa4
- 0x31bc <do_mfill+180>: add r2, r3, #48 ; 0x30
- 0x31c0 <do_mfill+184>: sub r3, r11, #172 ; 0xac
- 0x31c4 <do_mfill+188>: str r3, [sp]
- 0x31c8 <do_mfill+192>: sub r3, r11, #188 ; 0xbc
- 0x31cc <do_mfill+196>: str r3, [sp, #4]
- 0x31d0 <do_mfill+200>: ldr r3, [pc, #484] ; 0x33bc <do_mcmp+28>
- 0x31d4 <do_mfill+204>: str r3, [sp, #8]
- 0x31d8 <do_mfill+208>: mov r0, r2
- 0x31dc <do_mfill+212>: mov r1, #112 ; 0x70
- 0x31e0 <do_mfill+216>: mov r2, #1 ; 0x1
- 0x31e4 <do_mfill+220>: mov r3, #0 ; 0x0
- 0x31e8 <do_mfill+224>: bl 0xe15c <init_opts+52>
81 (void *)&set_32bit, (bool *)0, "fill 32 bit units");
82 init_opts(&opts[4], '2', false, OPTION_ARG_TYPE_FLG,
- 0x31ec <do_mfill+228>: sub r3, r11, #164 ; 0xa4
- 0x31f0 <do_mfill+232>: add r2, r3, #72 ; 0x48
- 0x31f4 <do_mfill+236>: sub r3, r11, #192 ; 0xc0
- 0x31f8 <do_mfill+240>: str r3, [sp]
- 0x31fc <do_mfill+244>: mov r3, #0 ; 0x0
- 0x3200 <do_mfill+248>: str r3, [sp, #4]
- 0x3204 <do_mfill+252>: ldr r3, [pc, #436] ; 0x33c0 <do_mcmp+32>
- 0x3208 <do_mfill+256>: str r3, [sp, #8]
- 0x320c <do_mfill+260>: mov r0, r2
- 0x3210 <do_mfill+264>: mov r1, #52 ; 0x34
- 0x3214 <do_mfill+268>: mov r2, #0 ; 0x0
- 0x3218 <do_mfill+272>: mov r3, #2 ; 0x2
- 0x321c <do_mfill+276>: bl 0xe15c <init_opts+52>
83 (void **)&set_16bit, (bool *)0, "fill 16 bit units");
84 init_opts(&opts[5], '1', false, OPTION_ARG_TYPE_FLG,
- 0x3220 <do_mfill+280>: sub r3, r11, #164 ; 0xa4
- 0x3224 <do_mfill+284>: add r2, r3, #96 ; 0x60
- 0x3228 <do_mfill+288>: sub r3, r11, #196 ; 0xc4
- 0x322c <do_mfill+292>: str r3, [sp]
- 0x3230 <do_mfill+296>: mov r3, #0 ; 0x0
- 0x3234 <do_mfill+300>: str r3, [sp, #4]
- 0x3238 <do_mfill+304>: ldr r3, [pc, #388] ; 0x33c4 <do_mcmp+36>
- 0x323c <do_mfill+308>: str r3, [sp, #8]
- 0x3240 <do_mfill+312>: mov r0, r2
- 0x3244 <do_mfill+316>: mov r1, #50 ; 0x32
- 0x3248 <do_mfill+320>: mov r2, #0 ; 0x0
- 0x324c <do_mfill+324>: mov r3, #2 ; 0x2
- 0x3250 <do_mfill+328>: bl 0xe15c <init_opts+52>
85 (void **)&set_8bit, (bool *)0, "fill 8 bit units");
86 if (!scan_opts(argc, argv, 1, opts, 6, 0, 0, "")) {
- 0x3254 <do_mfill+332>: sub r3, r11, #164 ; 0xa4
- 0x3258 <do_mfill+336>: add r2, r3, #120 ; 0x78
- 0x325c <do_mfill+340>: sub r3, r11, #200 ; 0xc8
- 0x3260 <do_mfill+344>: str r3, [sp]
- 0x3264 <do_mfill+348>: mov r3, #0 ; 0x0
- 0x3268 <do_mfill+352>: str r3, [sp, #4]
- 0x326c <do_mfill+356>: ldr r3, [pc, #340] ; 0x33c8 <do_mcmp+40>
- 0x3270 <do_mfill+360>: str r3, [sp, #8]
- 0x3274 <do_mfill+364>: mov r0, r2
- 0x3278 <do_mfill+368>: mov r1, #49 ; 0x31
- 0x327c <do_mfill+372>: mov r2, #0 ; 0x0
- 0x3280 <do_mfill+376>: mov r3, #2 ; 0x2
- 0x3284 <do_mfill+380>: bl 0xe15c <init_opts+52>
- 0x3288 <do_mfill+384>: sub r12, r11, #164 ; 0xa4
- 0x328c <do_mfill+388>: mov r3, #6 ; 0x6
- 0x3290 <do_mfill+392>: str r3, [sp]
- 0x3294 <do_mfill+396>: mov r3, #0 ; 0x0
87 return;
- 0x3298 <do_mfill+400>: str r3, [sp, #4]
88 }
89 if (!base_set || !len_set) {
- 0x329c <do_mfill+404>: mov r3, #0 ; 0x0
- 0x32a0 <do_mfill+408>: str r3, [sp, #8]
- 0x32a4 <do_mfill+412>: ldr r3, [pc, #288] ; 0x33cc <do_mcmp+44>
- 0x32a8 <do_mfill+416>: str r3, [sp, #12]
- 0x32ac <do_mfill+420>: ldr r0, [r11, #-16]
- 0x32b0 <do_mfill+424>: ldr r1, [r11, #-20]
90 diag_printf("usage: mfill -b <addr> -l <length> [-p <pattern>] [-1|-2|-4]\n");
- 0x32b4 <do_mfill+428>: mov r2, #1 ; 0x1
- 0x32b8 <do_mfill+432>: mov r3, r12
91 return;
- 0x32bc <do_mfill+436>: bl 0xe1cc <scan_opts+52>
92 }
93 if (!pat_set) {
- 0x32c0 <do_mfill+440>: mov r3, r0
- 0x32c4 <do_mfill+444>: cmp r3, #0 ; 0x0
- 0x32c8 <do_mfill+448>: bne 0x32d0 <do_mfill+456>
94 pat = 0;
- 0x32cc <do_mfill+452>: b 0x33b0 <do_mcmp+16>
- 0x32d0 <do_mfill+456>: ldr r3, [r11, #-180]
95 }
96 // No checks here
97 if (set_8bit) {
- 0x32d4 <do_mfill+460>: cmp r3, #0 ; 0x0
- 0x32d8 <do_mfill+464>: beq 0x32e8 <do_mfill+480>
- 0x32dc <do_mfill+468>: ldr r3, [r11, #-184]
98 // Fill 8 bits at a time
99 while ((len -= sizeof(cyg_uint8)) >= 0) {
- 0x32e0 <do_mfill+472>: cmp r3, #0 ; 0x0
- 0x32e4 <do_mfill+476>: bne 0x32f4 <do_mfill+492>
- 0x32e8 <do_mfill+480>: ldr r0, [pc, #224] ; 0x33d0 <do_mcmp+48>
- 0x32ec <do_mfill+484>: bl 0xb3e0 <diag_printf+52>
- 0x32f0 <do_mfill+488>: b 0x33b0 <do_mcmp+16>
- 0x32f4 <do_mfill+492>: ldr r3, [r11, #-188]
100 *((cyg_uint8 *)base)++ = (cyg_uint8)pat;
- 0x32f8 <do_mfill+496>: cmp r3, #0 ; 0x0
- 0x32fc <do_mfill+500>: bne 0x3308 <do_mfill+512>
- 0x3300 <do_mfill+504>: mov r3, #0 ; 0x0
- 0x3304 <do_mfill+508>: str r3, [r11, #-172]
- 0x3308 <do_mfill+512>: ldr r3, [r11, #-200]
- 0x330c <do_mfill+516>: cmp r3, #0 ; 0x0
101 }
102 } else if (set_16bit) {
- 0x3310 <do_mfill+520>: beq 0x3344 <do_mfill+572>
- 0x3314 <do_mfill+524>: ldr r3, [r11, #-176]
- 0x3318 <do_mfill+528>: sub r3, r3, #1 ; 0x1
103 // Fill 16 bits at a time
104 while ((len -= sizeof(cyg_uint16)) >= 0) {
- 0x331c <do_mfill+532>: str r3, [r11, #-176]
- 0x3320 <do_mfill+536>: cmp r3, #0 ; 0x0
- 0x3324 <do_mfill+540>: bge 0x332c <do_mfill+548>
- 0x3328 <do_mfill+544>: b 0x33b0 <do_mcmp+16>
- 0x332c <do_mfill+548>: ldr r3, [r11, #-168]
- 0x3330 <do_mfill+552>: add r2, r3, #1 ; 0x1
105 *((cyg_uint16 *)base)++ = (cyg_uint16)pat;
- 0x3334 <do_mfill+556>: str r2, [r11, #-168]
- 0x3338 <do_mfill+560>: ldrb r2, [r11, #-172]
- 0x333c <do_mfill+564>: strb r2, [r3]
- 0x3340 <do_mfill+568>: b 0x3314 <do_mfill+524>
- 0x3344 <do_mfill+572>: ldr r3, [r11, #-196]
- 0x3348 <do_mfill+576>: cmp r3, #0 ; 0x0
106 }
107 } else {
108 // Default - 32 bits
109 while ((len -= sizeof(cyg_uint32)) >= 0) {
- 0x334c <do_mfill+580>: beq 0x3380 <do_mfill+632>
- 0x3350 <do_mfill+584>: ldr r3, [r11, #-176]
- 0x3354 <do_mfill+588>: sub r3, r3, #2 ; 0x2
- 0x3358 <do_mfill+592>: str r3, [r11, #-176]
- 0x335c <do_mfill+596>: cmp r3, #0 ; 0x0
- 0x3360 <do_mfill+600>: bge 0x3368 <do_mfill+608>
110 *((cyg_uint32 *)base)++ = (cyg_uint32)pat;
- 0x3364 <do_mfill+604>: b 0x33b0 <do_mcmp+16>
- 0x3368 <do_mfill+608>: ldr r3, [r11, #-168]
- 0x336c <do_mfill+612>: add r2, r3, #2 ; 0x2
- 0x3370 <do_mfill+616>: str r2, [r11, #-168]
- 0x3374 <do_mfill+620>: ldrh r2, [r11, #-172]
- 0x3378 <do_mfill+624>: strh r2, [r3]
- 0x337c <do_mfill+628>: b 0x3350 <do_mfill+584>
- 0x3380 <do_mfill+632>: ldr r3, [r11, #-176]
- 0x3384 <do_mfill+636>: sub r3, r3, #4 ; 0x4
- 0x3388 <do_mfill+640>: str r3, [r11, #-176]
- 0x338c <do_mfill+644>: cmp r3, #0 ; 0x0
- 0x3390 <do_mfill+648>: bge 0x3398 <do_mfill+656>
- 0x3394 <do_mfill+652>: b 0x33b0 <do_mcmp+16>
- 0x3398 <do_mfill+656>: ldr r3, [r11, #-168]
- 0x339c <do_mfill+660>: add r2, r3, #4 ; 0x4
Any one knows how to solve this problem? Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ECOS] gdb disassemble shift about 52 bytes in arm platform
2008-04-28 11:14 [ECOS] gdb disassemble shift about 52 bytes in arm platform Frank Lin
@ 2008-04-28 13:32 ` Andrew Lunn
2008-04-28 15:34 ` Frank Lin
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2008-04-28 13:32 UTC (permalink / raw)
To: Frank Lin; +Cc: ecos-discuss
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?
What is on your hardware is the same as the object file on your host
and that the objects are from your current sources?
Try arm-elf-objdump -D myprog.elf | less
and see if there is the same problem. This removes the target from the
picture.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ECOS] gdb disassemble shift about 52 bytes in arm platform
2008-04-28 13:32 ` Andrew Lunn
@ 2008-04-28 15:34 ` Frank Lin
2008-04-28 23:59 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: Frank Lin @ 2008-04-28 15:34 UTC (permalink / raw)
To: Andrew Lunn; +Cc: ecos-discuss
----- 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ECOS] gdb disassemble shift about 52 bytes in arm platform
2008-04-28 15:34 ` Frank Lin
@ 2008-04-28 23:59 ` Andrew Lunn
2008-04-29 0:01 ` Frank Lin
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2008-04-28 23:59 UTC (permalink / raw)
To: Frank Lin; +Cc: Andrew Lunn, ecos-discuss
On Mon, Apr 28, 2008 at 09:31:51PM +0800, Frank Lin wrote:
>
> ----- 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:
Now try using gdb to disassemble the code, but do not connect to the
target. This will force gdb to disassemble what is in the elf file,
not what is in the targets memory.
I still think the symbol table you passed to gdb does not match what
is in memory of your target. If gdb correctly disassembles when not
connected to the target, but gets it wrong when connected to the
target, i would really suspect you need to download your image again.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ECOS] gdb disassemble shift about 52 bytes in arm platform
2008-04-28 23:59 ` Andrew Lunn
@ 2008-04-29 0:01 ` Frank Lin
0 siblings, 0 replies; 5+ messages in thread
From: Frank Lin @ 2008-04-29 0:01 UTC (permalink / raw)
To: Andrew Lunn; +Cc: ecos-discuss
----- Original Message -----
From: "Andrew Lunn" <andrew@lunn.ch>
To: "Frank Lin" <franklin373@gmail.com>
Cc: "Andrew Lunn" <andrew@lunn.ch>; <ecos-discuss@ecos.sourceware.org>
Sent: Monday, April 28, 2008 9:46 PM
Subject: Re: [ECOS] gdb disassemble shift about 52 bytes in arm platform
Thank you, Andrew,
Your mail direct me the correct way, I look at the build log, it shows that the redboot.bin is create with checksum, In my situation I use redboot.elf to gdb, and use redboot.bin to burn to ROM, redboot.elf is correct, redboot.bin is incorrect, I guess it is caused by checksum.
Now I use command:
arm-elf-objcopy -O srec redboot.elf redboot.srec
then I burn to ROM using redboot.srec, Now it got correct result.
Thank you again, Andrew.
Build Log:
arm-elf-gcc -c -I/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/include -I/ecos-d/cygwin/opt/ecos-2.0/packages/redboot/v2_0 -I/ecos-d/cygwin/opt/ecos-2.0/packages/redboot/v2_0/src -I/ecos-d/cygwin/opt/ecos-2.0/packages/redboot/v2_0/tests -I. -mcpu=arm7tdmi -mno-short-load-words -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -Wa,-D -g -gdwarf-2 -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -o /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/lib/version.o /ecos-d/cygwin/opt/ecos-2.0/packages/redboot/v2_0/src/version.c
arm-elf-gcc -mcpu=arm7tdmi -mno-short-load-words -Wl,-Map,test.map -Wl,--gc-sections -Wl,-static -g -nostdlib -L/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/lib -Ttarget.ld -o /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/bin/redboot.elf /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/lib/version.o
make[1]: Leaving directory `/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_build/redboot/v2_0'
make -r -C hal/arm/s3c44b0x/v2_0 /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/bin/redboot.bin
make[1]: Entering directory `/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_build/hal/arm/s3c44b0x/v2_0'
# First build version with no checksum.
arm-elf-gcc -c -I/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/include -I/ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0 -I/ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0/src -I/ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0/tests -I. -Wp,-MD,deps.tmp -I/ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0/src/ -mcpu=arm7tdmi -mno-short-load-words -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -Wa,-D -g -gdwarf-2 -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -o src/redboot_ncs.o /ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0/src/redboot_module.c
arm-elf-gcc -mcpu=arm7tdmi -mno-short-load-words -Wl,-Map,test.map -Wl,--gc-sections -Wl,-static -g -nostdlib -L/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/lib -Ttarget.ld -o src/redboot_ncs.tmp /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/lib/version.o src/redboot_ncs.o
arm-elf-objcopy --strip-debug src/redboot_ncs.tmp src/redboot_ncs.img
arm-elf-objcopy -O binary src/redboot_ncs.img src/redboot_ncs.bin
# @rm src/redboot_ncs.tmp src/redboot_ncs.img
# Prepare dependency file
# Then build version with checksum from previously built image.
arm-elf-gcc -c -DCHECKSUM=`src/flash_cksum.tcl src/redboot_ncs.bin` -I/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/include -I/ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0 -I/ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0/src -I/ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0/tests -I. -I/ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0/src/ -mcpu=arm7tdmi -mno-short-load-words -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -Wa,-D -g -gdwarf-2 -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -o src/redboot.o /ecos-d/cygwin/opt/ecos-2.0/packages/hal/arm/s3c44b0x/v2_0/src/redboot_module.c
arm-elf-gcc -mcpu=arm7tdmi -mno-short-load-words -Wl,-Map,test.map -Wl,--gc-sections -Wl,-static -g -nostdlib -L/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/lib -Ttarget.ld -o src/redboot.tmp /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/lib/version.o src/redboot.o
arm-elf-objcopy --strip-debug src/redboot.tmp /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/bin/redboot.img
arm-elf-objcopy -O binary /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/bin/redboot.img src/redboot.bin
uuencode src/redboot.bin redboot.bin | tr '`' ' ' > /ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_install/bin/redboot.UU
make[1]: Leaving directory `/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_build/hal/arm/s3c44b0x/v2_0'
build finished
make: Leaving directory `/ecos-d/cygwin/opt/ecos-2.0/build/s3c44b0x_redboot/s3c44b0x_redboot_build'
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-04-28 15:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-28 11:14 [ECOS] gdb disassemble shift about 52 bytes in arm platform Frank Lin
2008-04-28 13:32 ` Andrew Lunn
2008-04-28 15:34 ` Frank Lin
2008-04-28 23:59 ` Andrew Lunn
2008-04-29 0:01 ` Frank Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).