Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] solib-svr4.c: Add DT_MIPS_RLD_MAP support for 64-bit targets
Date: Fri, 20 Dec 2002 22:59:00 -0000	[thread overview]
Message-ID: <1021221064553.ZM27580@localhost.localdomain> (raw)

I've just committed the patch below.

	* solib-svr4.c (elf_locate_base): Fix sizeof() related bug.  Add
	DT_MIPS_RLD_MAP case for 64-bit targets.

Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.27
diff -u -p -r1.27 solib-svr4.c
--- solib-svr4.c	21 Oct 2002 18:42:40 -0000	1.27
+++ solib-svr4.c	21 Dec 2002 06:39:39 -0000
@@ -446,15 +446,16 @@ elf_locate_base (void)
 	  else if (dyn_tag == DT_MIPS_RLD_MAP)
 	    {
 	      char *pbuf;
+	      int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
 
-	      pbuf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
+	      pbuf = alloca (pbuf_size);
 	      /* DT_MIPS_RLD_MAP contains a pointer to the address
 		 of the dynamic link structure.  */
 	      dyn_ptr = bfd_h_get_32 (exec_bfd, 
 				      (bfd_byte *) x_dynp->d_un.d_ptr);
-	      if (target_read_memory (dyn_ptr, pbuf, sizeof (pbuf)))
+	      if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
 		return 0;
-	      return extract_unsigned_integer (pbuf, sizeof (pbuf));
+	      return extract_unsigned_integer (pbuf, pbuf_size);
 	    }
 	}
     }
@@ -476,6 +477,20 @@ elf_locate_base (void)
 	      dyn_ptr = bfd_h_get_64 (exec_bfd, 
 				      (bfd_byte *) x_dynp->d_un.d_ptr);
 	      return dyn_ptr;
+	    }
+	  else if (dyn_tag == DT_MIPS_RLD_MAP)
+	    {
+	      char *pbuf;
+	      int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
+
+	      pbuf = alloca (pbuf_size);
+	      /* DT_MIPS_RLD_MAP contains a pointer to the address
+		 of the dynamic link structure.  */
+	      dyn_ptr = bfd_h_get_64 (exec_bfd, 
+				      (bfd_byte *) x_dynp->d_un.d_ptr);
+	      if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
+		return 0;
+	      return extract_unsigned_integer (pbuf, pbuf_size);
 	    }
 	}
     }


                 reply	other threads:[~2002-12-21  6:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1021221064553.ZM27580@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.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