Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <lgustavo@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: Sat, 10 Aug 2013 00:33:00 -0000	[thread overview]
Message-ID: <52058A17.2050101@codesourcery.com> (raw)
In-Reply-To: <520524D8.40408@codesourcery.com>

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.


> +/* 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.

> +
> +  /* 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.

> @@ -684,24 +795,50 @@ dsbt_current_sos (void)
>   					   sizeof lm_buf.l_addr.map,
>   					   byte_order);
>
> -      ret = target_read_memory (map_addr + 12, (gdb_byte *) &indexword,
> -				sizeof indexword);
> -      if (ret)
> +      /* Fetch the name.  */
> +      addr = extract_unsigned_integer (lm_buf.l_name,
> +				       sizeof (lm_buf.l_name),
> +				       byte_order);
> +      target_read_string (addr, &name_buf, SO_NAME_MAX_PATH_SIZE - 1,
> +			  &errcode);
> +
> +      if (errcode != 0)
>   	{
> -	  warning (_("dsbt_current_sos: Unable to read dsbt index."
> -		     "  Shared object chain may be incomplete."));
> -	  break;
> +	  warning (_("dsbt_current_sos: Can't read pathname for link "
> +		   "map entry: %s."), safe_strerror (errcode));
> +
> +	  /* Since we do not have a pathname, just assume that
> +	     dsbt_index equals a dummy value of 1.  This way we can
                                                ^^ -1?

-- 
Yao (齐尧)


  reply	other threads:[~2013-08-10  0:33 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 [this message]
2013-08-12 13:41             ` Luis Machado
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=52058A17.2050101@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    --cc=palves@redhat.com \
    --cc=vapier@gentoo.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