On 03/01/2012 09:22 AM, Albert ARIBAUD wrote: > Hi Peter, > > Le 29/02/2012 17:42, Peter Barada a écrit : >> On 02/28/2012 05:04 PM, Albert ARIBAUD wrote: >>> Hi Peter, >>> >>> Le 27/02/2012 23:00, Peter Barada a écrit : >>>> When debugging u-boot, after relocation its tedious to calculate positions >>>> of the various sections (.data, .rodata, .bss). To make it easier, add >>>> the structure "sections" to gd_t that contains the relocated start of >>>> those sections. Then the gdb command "add-symbol-file" can by used with >>>> "-s<section> <address>" that corresponds to the values in gd_t->sections. >>> NAK until I get an explanation and usage scenario for this, because I've >>> never had to do calculations on sections so far, so I want to understand >>> why it would be needed. >>> >>> Amicalement, >> Weird. Digging further its looking more like a problem with GDB... >> >> I'm using the CodeSourcery 2009q1-203 toolchain (for ARM), and >> "add-symbol-file u-boot 0x...." only relocated symbols in the .text >> segment, not .data, .rodata, and .bss sections. Looking at newer >> toolchains (CodeSourcery 2011.09-70) I see even stranger results: >> >> Current directory is /home/peter/work/logic/git/u-boot-branches/ >> GNU gdb (Sourcery CodeBench Lite 2011.09-70) 7.2.50.20100908-cvs >> Copyright (C) 2010 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later >> <http://gnu.org/licenses/gpl.html> >> This is free software: you are free to change and redistribute it. >> There is NO WARRANTY, to the extent permitted by law. Type "show copying" >> and "show warranty" for details. >> This GDB was configured as "--host=i686-pc-linux-gnu >> --target=arm-none-linux-gnueabi". >> For bug reporting instructions, please see: >> <https://support.codesourcery.com/GNUToolchain/>... >> Reading symbols from >> /home/peter/work/logic/git/u-boot-branches/u-boot...done. >> (gdb) info file >> Symbols from "/home/peter/work/logic/git/u-boot-branches/u-boot". >> Local exec file: >> `/home/peter/work/logic/git/u-boot-branches/u-boot', file type >> elf32-littlearm. >> Entry point: 0x80100000 >> 0x80100000 - 0x80124a30 is .text >> 0x80124a30 - 0x8012d43a is .rodata >> 0x8012d43c - 0x8012d488 is .hash >> 0x8012d488 - 0x8012dee0 is .data >> 0x8012dee0 - 0x8012deec is .got.plt >> 0x8012deec - 0x8012e544 is .u_boot_cmd >> 0x8013354c - 0x8013362c is .dynsym >> 0x8012e544 - 0x8013354c is .rel.dyn >> 0x8012e544 - 0x80165388 is .bss >> (gdb)(gdb) symbol-file >> Discard symbol table from >> `/home/peter/work/logic/git/u-boot-branches/u-boot'? (y or n) y >> No symbol file now. >> (gdb) *add-symbol-file u-boot 0x8ff8a000 -readnow -s .rodata 0x8FFAEA30 >> -s .data 0x8FFB7488 -s .bss 0x8FFB8544* >> add symbol table from file "u-boot" at >> .text_addr = 0x8ff8a000 >> .rodata_addr = 0x8ffaea30 >> .data_addr = 0x8ffb7488 >> .bss_addr = 0x8ffb8544 >> (y or n) y >> Reading symbols from >> /home/peter/work/logic/git/u-boot-branches/u-boot...expanding to full >> symbols...done. >> (gdb) *p&stdio_devices* >> $26 = (struct stdio_dev *(*)[3]) *0x80131c0c* >> (gdb) info sym stdio_devices >> __rel_dyn_start + 14024 in section .rel.dyn >> (gdb) info sym boards >> boards in section .data >> (gdb) p *&boards* >> $27 = (struct board_id (*)[2][2]) *0x8ffb7ec0* >> (gdb) shell nm u-boot | grep stdio_devices >> *80131c0c* B stdio_devices >> (gdb) shell nm u-boot | grep boards >> *8012dec0* d boards >> (gdb) >> >> Note that "boards" gets properly relocated whereas "stdio_devices" does >> not - apparently a lot (all?) of the .bss symbols are not properly >> relocated. Hmm, I wonder if this is caused by .rel.dyn overlaing .bss... >> >> Which version of GDB are you using on ARM that properly relocates all >> the sections after "add-symbol-file u-boot<addr>"? > I routinely use ELDK42 (4.2.2 toochain) and stcok (linaro) Ubuntu > (4.6.1). I don't remember having hit this issue -- although I am hitting > another one where breakpoints are set 4 or 8 bytes further than they > should, but the symbols themselves are ok; but I rarely use global .data > or .bss symbols, so I may have missed the issue. > > Anyway, 'help add-symbol-file' says a single address applies to > consecutive sections, so until it is sorted out with the GDB people why > this does not work, my NAK still holds. > > Amicalement, I agree with the NAK, its an issue in GDB, not u-boot...
-- Peter Barada peter.bar...@logicpd.com _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot