how to remote debug flat binary?

i was trying remote debugging on my mips based embedded system. my cross-compilation tool chain is generating a flat binary and not in elf format. so the documentation asks me to specify the addresses of text, data and bss sections to the gdb client using add-symbol-file command by finding the offsets in generated .map file. here is the command i am supposed to run in host machine: #mips-linux-gdb (gdb)target remote 192.168.128.8:5050 Remote debugging using 192.168.128.8:5050

0x80c90050 in ?? () (gdb)add-symbol-file hello.gdb 0x80c90050 -s .data 0x80c9???? -s .bss 0x80c9???? (gdb)next Cannot find bounds of current function

i am asked to add the returned address to the offsets found in .map file to get data and bss addresses. i don't know which address to pick as the offsets for data and bss segments, so i tried different options but got the same errors.

when i say 'continue' it works fine(needs no symbol table info) but when i set a breakpoint i get this error: (gdb)b main (gdb)c Program received signal SIGTRAP, Trace/breakpoint trap. warning: Warning: GDB can't find the start of the function at

0x80c902cc.

GDB is unable to find the start of the function at 0x80c902cc and thus can't determine the size of that function's stack frame. This means that GDB may be unable to access that stack frame, or the frames below it. This problem is most likely caused by an invalid program counter or stack pointer. However, if you think GDB should simply search farther back from 0x80c902cc for code which looks like the beginning of a function, you can increase the range of the search using the `set heuristic-fence-post' command.

0x80c902cc in ?? ()

its a small hello world program. these are quotes from my hello.map file:

.data 0x0000000000007680 0x578 0x0000000000007680 .=ALIGN(0x4) 0x0000000000007680 _sdata=. 0x0000000000007680 __data_start=. 0x0000000000007680 data_start=. 0x000000000000f670 _gp=(ALIGN(0x10)+0x7ff0) *(.data)

.data 0x0000000000007ac0 0xd0 hello.elf2flt 0x0000000000007b74 stdout 0x0000000000007ae0 errno 0x0000000000007b84 _free_buffer_index 0x0000000000007ad4 __environ 0x0000000000007b10 _stdio_streams 0x0000000000007b80 _free_file_list 0x0000000000007ad4 environ 0x0000000000007b70 stdin 0x0000000000007b78 stderr 0x0000000000007b7c __IO_list 0x0000000000007ad0 __uClibc_cleanup *(.data1) *(.data.*) *(.gnu.linkonce.d*) *(.data1)

.bss 0x0000000000007c00 0x450 0x0000000000007c00 .=ALIGN(0x4) 0x0000000000007c00 _sbss=ALIGN(0x4) 0x0000000000007c00 __bss_start=. *(.dynsbss) *(.sbss) *(.sbss.*) *(.scommon) *(.dynbss) *(.bss) .bss 0x0000000000007c00 0x450 hello.elf2flt 0x0000000000007c50 _fixed_buffers *(.bss.*)

i thought i should pick the offset from the line containing hello.elf2flt. what am i doing wrong? what is the correct procedure to remotely debug flat binaries with address information in .map files?

thank you murali

Reply to
chinnmaya
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.