public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Torsten Mohr <tmohr@s.netic.de>
To: newlib@sourceware.org,  gdb@sourceware.org
Cc: Jeff Johnston <jjohnstn@redhat.com>
Subject: Re: malloc() never returns
Date: Thu, 08 Jun 2006 21:50:00 -0000	[thread overview]
Message-ID: <200606082341.12598.tmohr@s.netic.de> (raw)
In-Reply-To: <44886BBF.1030404@redhat.com>

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.

       reply	other threads:[~2006-06-08 21:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200606081246.20231.tmohr@s.netic.de>
     [not found] ` <44886BBF.1030404@redhat.com>
2006-06-08 21:50   ` Torsten Mohr [this message]
2006-06-09 13:51     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200606082341.12598.tmohr@s.netic.de \
    --to=tmohr@s.netic.de \
    --cc=gdb@sourceware.org \
    --cc=jjohnstn@redhat.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).