Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <lgustavo@codesourcery.com>
To: Yao Qi <yao@codesourcery.com>
Cc: Pedro Alves <palves@redhat.com>,
	 "'gdb-patches@sourceware.org'" <gdb-patches@sourceware.org>,
	Mike Frysinger <vapier@gentoo.org>
Subject: Re: [PATCH, gdbserver] Further cleanup of FDPIC/DSBT divergences
Date: Mon, 12 Aug 2013 13:41:00 -0000	[thread overview]
Message-ID: <5208E601.6070000@codesourcery.com> (raw)
In-Reply-To: <52058A17.2050101@codesourcery.com>

Hi,

On 08/09/2013 09:32 PM, Yao Qi wrote:
> On 08/10/2013 01:20 AM, Luis Machado wrote:
>> +/* Scan for DYNTAG in .dynamic section of ABFD.  If DYNTAG is found 1
>> +   is returned and the corresponding PTR is set.  We only search in
>> +   the BFD, not in the target's memory.  */
>> +
>> +static int
>> +scan_dyntag_in_bfd (int dyntag, bfd *abfd, CORE_ADDR *ptr)
>
> Luis,
> We've already have a function scan_dyntag in solib-dsbt.c which reads
> in both BFD and the target memory.  There are some duplications in
> scan_dyntag and scan_dyntag_in_bfd.  We can combine them into one
> function, probably.

I seem to recall the code to read target memory, in the case of targets 
that do relocations based on loadmaps, get this information wrong, based 
on past experience with a different DSBT-based target.

 From what i recall, it tries to read the dsbt_index from the main 
executable's .dynamic, but the information is in the solib's .dynamic 
section.

I can't be sure it works for c6x since there is no target for me to test 
on. If someone has access to that, i can coordinate some testing. This 
is the biggest problem right now.

>
>
>> +/* Given a shared library filename, load it up and find
>> +   out what is its dsbt index.  */
>> +
>> +static int
>> +fetch_solib_dsbt_index (const char *filename)
>> +{
>> +  unsigned long dsbt_index;
>> +  CORE_ADDR addr;
>> +  bfd *solib_bfd = NULL;
>> +  volatile struct gdb_exception ex;
>> +
>> +  if (filename == NULL)
>> +    return -1;
>> +
>> +  /* Open the shared library.  */
>> +  TRY_CATCH (ex, RETURN_MASK_ALL)
>> +    {
>> +      solib_bfd = solib_bfd_open ((char *) filename);
>> +    }
>> +  if (solib_bfd == NULL)
>> +    {
>> +      return -1;
>> +    }
>
> Unnecessary braces.

Fixed.

>
>> +
>> +  /* Fetch the DSBT_INDEX from the shared library file on disk.  */
>> +  if (scan_dyntag_in_bfd (DT_TIC6X_DSBT_INDEX, solib_bfd, &addr) == 0)
>
> I don't find the definition of DT_TIC6X_DSBT_INDEX.  In uclibc, I only
> find DT_C6000_DSBT_INDEX.
>

That is exactly what it is. I named it DT_TIC6X_DSBT_INDEX to make it 
more meaningful, but i can use DT_C6000_DSBT_INDEX without problems i think.


  reply	other threads:[~2013-08-12 13:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 18:57 Luis Machado
2013-06-24 13:47 ` Yao Qi
2013-06-24 14:25   ` Luis Machado
2013-08-08 16:41     ` Luis Machado
2013-08-09 15:08       ` Pedro Alves
2013-08-09 17:20         ` Luis Machado
2013-08-10  0:33           ` Yao Qi
2013-08-12 13:41             ` Luis Machado [this message]
2013-08-12 14:06               ` Pedro Alves
2013-08-26  5:31           ` Mike Frysinger
2013-06-24 16:17 ` Mike Frysinger
2013-06-25 15:03 ` Pedro Alves
2013-06-25 15:04   ` Luis Machado
2013-06-25 16:26   ` Mike Frysinger

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=5208E601.6070000@codesourcery.com \
    --to=lgustavo@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=vapier@gentoo.org \
    --cc=yao@codesourcery.com \
    /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