From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26325 invoked by alias); 31 Aug 2008 17:52:57 -0000 Received: (qmail 25419 invoked by uid 22791); 31 Aug 2008 17:52:44 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.17.162) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 31 Aug 2008 17:51:44 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.1/8.13.1) with ESMTP id m7VHpgP3013965 for ; Sun, 31 Aug 2008 17:51:42 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m7VHpfRC3866676 for ; Sun, 31 Aug 2008 19:51:41 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m7VHpfLW020314 for ; Sun, 31 Aug 2008 19:51:41 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m7VHpfQ4020309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 31 Aug 2008 19:51:41 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (localhost.localdomain [127.0.0.1]) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpfF7003258 for ; Sun, 31 Aug 2008 19:51:41 +0200 Received: (from uweigand@localhost) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8/Submit) id m7VHpfSD003257 for gdb-patches@sourceware.org; Sun, 31 Aug 2008 19:51:41 +0200 Message-Id: <20080831175141.019838000@de.ibm.com> References: <20080831175045.128504000@de.ibm.com> User-Agent: quilt/0.46-1 Date: Sun, 31 Aug 2008 17:53:00 -0000 From: uweigand@de.ibm.com To: gdb-patches@sourceware.org Subject: [rfc][36/37] Eliminate builtin_type_ macros: Use target arch in solib code Content-Disposition: inline; filename=diff-type-solib Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00705.txt.bz2 Hello, just like the bsd-uthread patch, this patch changes every instance of builtin_type_void_data_ptr in solib-related code to use target_gdbarch associated builtin types instead. Bye, Ulrich ChangeLog: * solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Use builtin types of target_gdbarch instead of builtin_type_void_data_ptr. (LM_DYNAMIC_FROM_LINK_MAP, LM_NEXT, LM_NAME, IGNORE_FIRST_LINK_MAP_ENTRY, scan_dyntag, elf_locate_base, solib_svr4_r_map, solib_svr4_r_brk, solib_svr4_r_ldsomap, open_symbol_file_object): Likewise. * nto-tdep.c (LM_ADDR): Likewise. Index: gdb-head/gdb/nto-tdep.c =================================================================== --- gdb-head.orig/gdb/nto-tdep.c +++ gdb-head/gdb/nto-tdep.c @@ -280,10 +280,10 @@ LM_ADDR (struct so_list *so) if (so->lm_info->l_addr == (CORE_ADDR)-1) { struct link_map_offsets *lmo = nto_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; so->lm_info->l_addr = - extract_typed_address (so->lm_info->lm + lmo->l_addr_offset, - builtin_type_void_data_ptr); + extract_typed_address (so->lm_info->lm + lmo->l_addr_offset, ptr_type); } return so->lm_info->l_addr; } Index: gdb-head/gdb/solib-svr4.c =================================================================== --- gdb-head.orig/gdb/solib-svr4.c +++ gdb-head/gdb/solib-svr4.c @@ -140,9 +140,10 @@ static CORE_ADDR LM_ADDR_FROM_LINK_MAP (struct so_list *so) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; return extract_typed_address (so->lm_info->lm + lmo->l_addr_offset, - builtin_type_void_data_ptr); + ptr_type); } static int @@ -157,9 +158,10 @@ static CORE_ADDR LM_DYNAMIC_FROM_LINK_MAP (struct so_list *so) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; return extract_typed_address (so->lm_info->lm + lmo->l_ld_offset, - builtin_type_void_data_ptr); + ptr_type); } static CORE_ADDR @@ -236,24 +238,27 @@ static CORE_ADDR LM_NEXT (struct so_list *so) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; return extract_typed_address (so->lm_info->lm + lmo->l_next_offset, - builtin_type_void_data_ptr); + ptr_type); } static CORE_ADDR LM_NAME (struct so_list *so) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; return extract_typed_address (so->lm_info->lm + lmo->l_name_offset, - builtin_type_void_data_ptr); + ptr_type); } static int IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; /* Assume that everything is a library if the dynamic loader was loaded late by a static executable. */ @@ -261,7 +266,7 @@ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_l return 0; return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset, - builtin_type_void_data_ptr) == 0; + ptr_type) == 0; } static CORE_ADDR debug_base; /* Base of dynamic linker structures */ @@ -566,13 +571,14 @@ scan_dyntag (int dyntag, bfd *abfd, CORE entry. */ if (ptr) { + struct type *ptr_type; gdb_byte ptr_buf[8]; CORE_ADDR ptr_addr; + ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8; if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0) - dyn_ptr = extract_typed_address (ptr_buf, - builtin_type_void_data_ptr); + dyn_ptr = extract_typed_address (ptr_buf, ptr_type); *ptr = dyn_ptr; } return 1; @@ -672,14 +678,15 @@ elf_locate_base (void) if (scan_dyntag (DT_MIPS_RLD_MAP, exec_bfd, &dyn_ptr) || scan_dyntag_auxv (DT_MIPS_RLD_MAP, &dyn_ptr)) { + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; gdb_byte *pbuf; - int pbuf_size = TYPE_LENGTH (builtin_type_void_data_ptr); + int pbuf_size = TYPE_LENGTH (ptr_type); pbuf = alloca (pbuf_size); /* DT_MIPS_RLD_MAP contains a pointer to the address of the dynamic link structure. */ if (target_read_memory (dyn_ptr, pbuf, pbuf_size)) return 0; - return extract_typed_address (pbuf, builtin_type_void_data_ptr); + return extract_typed_address (pbuf, ptr_type); } /* Find DT_DEBUG. */ @@ -763,9 +770,9 @@ static CORE_ADDR solib_svr4_r_map (void) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; - return read_memory_typed_address (debug_base + lmo->r_map_offset, - builtin_type_void_data_ptr); + return read_memory_typed_address (debug_base + lmo->r_map_offset, ptr_type); } /* Find r_brk from the inferior's debug base. */ @@ -774,9 +781,9 @@ static CORE_ADDR solib_svr4_r_brk (void) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; - return read_memory_typed_address (debug_base + lmo->r_brk_offset, - builtin_type_void_data_ptr); + return read_memory_typed_address (debug_base + lmo->r_brk_offset, ptr_type); } /* Find the link map for the dynamic linker (if it is not in the @@ -786,6 +793,7 @@ static CORE_ADDR solib_svr4_r_ldsomap (void) { struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; ULONGEST version; /* Check version, and return zero if `struct r_debug' doesn't have @@ -796,7 +804,7 @@ solib_svr4_r_ldsomap (void) return 0; return read_memory_typed_address (debug_base + lmo->r_ldsomap_offset, - builtin_type_void_data_ptr); + ptr_type); } /* @@ -829,7 +837,8 @@ open_symbol_file_object (void *from_ttyp int errcode; int from_tty = *(int *)from_ttyp; struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); - int l_name_size = TYPE_LENGTH (builtin_type_void_data_ptr); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; + int l_name_size = TYPE_LENGTH (ptr_type); gdb_byte *l_name_buf = xmalloc (l_name_size); struct cleanup *cleanups = make_cleanup (xfree, l_name_buf); @@ -851,7 +860,7 @@ open_symbol_file_object (void *from_ttyp read_memory (lm + lmo->l_name_offset, l_name_buf, l_name_size); /* Convert the address to host format. */ - l_name = extract_typed_address (l_name_buf, builtin_type_void_data_ptr); + l_name = extract_typed_address (l_name_buf, ptr_type); /* Free l_name_buf. */ do_cleanups (cleanups); -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com