From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25900 invoked by alias); 21 Dec 2002 06:46:13 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25891 invoked from network); 21 Dec 2002 06:46:11 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by 209.249.29.67 with SMTP; 21 Dec 2002 06:46:11 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id gBL6JXi30260 for ; Sat, 21 Dec 2002 01:19:33 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gBL6jx211316 for ; Sat, 21 Dec 2002 01:45:59 -0500 Received: from localhost.localdomain (vpn50-3.rdu.redhat.com [172.16.50.3]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gBL6jxL12837 for ; Sat, 21 Dec 2002 01:45:59 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id gBL6jrK27581 for gdb-patches@sources.redhat.com; Fri, 20 Dec 2002 23:45:53 -0700 Date: Fri, 20 Dec 2002 22:59:00 -0000 From: Kevin Buettner Message-Id: <1021221064553.ZM27580@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [PATCH] solib-svr4.c: Add DT_MIPS_RLD_MAP support for 64-bit targets MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-12/txt/msg00603.txt.bz2 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); } } }