This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB 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: arm-elf-gdb message <address> in ??()


Hi Ananda,

> So I basically did this:
> replaced my Startup code it with the c run time code for Arm found in newlib crt0.S -> GNUcrt0.S  
> In that file I simply replaced the call to main with a call to mymain
> Therafter the compiling options were
> arm-elf-gcc -Wall -g -nostdlib -ffreestanding -mlong-calls
> -Wa,-gstabs  -c GNUcrt0.S

Why are you using STABS rather than DWARF2 here ?  ie why not use:

  -Wa,--gdwarf2

> arm-elf-gcc -Wall -g -nostdlib -ffreestanding -mlong-calls -c trial1.c
> And the linking option was :
> arm-elf-gcc -nostdlib -Wl,-T memlink.ld -Wl -Map mapping -o tee_g.exe GNUcrt0.o trial1.o -lc
> Note libc used because of memset usage in GNUcrt0.S .

[You could always take out the call to memset and replace it with a
 simple loop if you want to...]

> Now running it on my board I can single step instructions, the
> dissassembly shows that the addresses contain the right instructions
> (comparison with objdump) in the gdb console but alas I can see
> neither the source code/ assembly  in the gui and I always get the
> message: 
>  <address> in ??()
> Seems to be that it is not finding the index of the section .text in
> the Startup code ...

Hmmm.  It may be the mixing of STABS debug information (in the
GNUcrt.o file) and the DWARF2 debug information (in the trial1.o
file). 

> What is bizarre is that without using the linker script and using
> the simulator I have access to the C ocde in the GUI. 
> So there has to be a mandatory field in the linker script that I am missing...
> Thanks for any clues or help.

This sounds like a bug in the linker's placement of "orphan"
sections.  These are sections which exist in the input object files
but which are not mentioned in the linker script.  Anyway try adding
the following lines to your linker script and see if they help.

Cheers
        Nick


  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }

  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }

  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }

  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }

  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }

  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }



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