public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: malloc() never returns
       [not found] ` <44886BBF.1030404@redhat.com>
@ 2006-06-08 21:50   ` Torsten Mohr
  2006-06-09 13:51     ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Torsten Mohr @ 2006-06-08 21:50 UTC (permalink / raw)
  To: newlib, gdb; +Cc: Jeff Johnston

Hi,

> It appears your static av_ array has been cleared.  Perhaps you have
> gone too far when clearing the .bss.  Track the static av_ array and see
> where it ends up after linking as well as what is in it.  That array
> should be initialized and non-zero by the time you get to main.  I don't
> have any experience with the v850 platform to give you any other direct
> suggestions.

thanks for your hint, it looks like you're right.

The array ___malloc_av_ is located in .data at 0x3ffe40c.
Or more precisely this is its VMA.

In my linker script i use the common way to place data into
ROM:

  .data :
  {
    *(.data)
    *(.data.*)
    *(.gnu.linkonce.d*)
    CONSTRUCTORS
  } > ram AT > rom

When i verify it with v850e-unknown-elf-objdump -h | grep .data
 7 .data         00000828  03ffe000  000071a8  00009000  2**2

Also, in hw2.srec at the expected offset of 0x040c (address of
___malloc_av_ - VMA(.data)) i see the expected data (at LMA(.data)
+ 0x40c):
S315000075A800000000FFFFFFFF0000020000000000CF
S315000075B8000000000CE4FF030CE4FF0314E4FF03DF
S315000075C814E4FF031CE4FF031CE4FF0324E4FF03A5
...


So all fits fine, except:
When i load the ELF file in "insight", i see the array ___malloc_av_
filled correctly, but after .data gets copied its all filled with 0x00.

So is it possible that GDB loads the sections in the ELF file to the
VMA and not to the LMA?


It looks to me like this, but this means that no program that uses
"> RAM AT > ROM" can run correctly in GDB, right?


Is there a standard solution to this standard problem?


Or do i misunderstand something here?


Best regards,
Torsten.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: malloc() never returns
  2006-06-08 21:50   ` malloc() never returns Torsten Mohr
@ 2006-06-09 13:51     ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2006-06-09 13:51 UTC (permalink / raw)
  To: Torsten Mohr; +Cc: newlib, gdb, Jeff Johnston

On Thu, Jun 08, 2006 at 11:41:12PM +0200, Torsten Mohr wrote:
> So is it possible that GDB loads the sections in the ELF file to the
> VMA and not to the LMA?

That is correct.

> Is there a standard solution to this standard problem?

No, I don't think there is.  However, people have started to mention
this as a problem more frequently in the last few months.  Maybe it's
time for "load" to grow an option to use LMA.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-08 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200606081246.20231.tmohr@s.netic.de>
     [not found] ` <44886BBF.1030404@redhat.com>
2006-06-08 21:50   ` malloc() never returns Torsten Mohr
2006-06-09 13:51     ` Daniel Jacobowitz

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).