From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13628 invoked by alias); 21 Aug 2008 13:28:29 -0000 Received: (qmail 13225 invoked by uid 22791); 21 Aug 2008 13:28:27 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 21 Aug 2008 13:27:52 +0000 Received: (qmail 3558 invoked from network); 21 Aug 2008 13:27:37 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 21 Aug 2008 13:27:37 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFC] Remove addr, endaddr, offset from obj_section Date: Thu, 21 Aug 2008 13:28:00 -0000 User-Agent: KMail/1.9.9 References: <200805161721.15817.pedro@codesourcery.com> <20080605191602.GC25085@caradoc.them.org> <200808201223.17427.pedro@codesourcery.com> In-Reply-To: <200808201223.17427.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_+1WrISG1AomioYI" Message-Id: <200808211428.30553.pedro@codesourcery.com> X-IsSubscribed: yes 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/msg00555.txt.bz2 --Boundary-00=_+1WrISG1AomioYI Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 895 On Wednesday 20 August 2008 12:23:16, Pedro Alves wrote: > On Thursday 05 June 2008 20:16:02, Daniel Jacobowitz wrote: > > On Fri, May 16, 2008 at 05:21:15PM +0100, Pedro Alves wrote: > > > I've been meaning to test this on Cygwin/MinGW/Dwarf before > > > posting, but since the subject came up, here it goes anyway. > > > > I looked through the patch, and I can't see anything wrong with it. > > It's OK to commit, though you might want to do that Cygwin test > > first... > > I've finally passed this through the testsuite on mingw32 + dwarf, and > found no regressions. > > I checked it in after also retesting on x86_64-unknown-linux-gnu. I missed that a several tdep files access obj_section->[addr|endaddr] directly. I checked in this patch to adjusts them. --enable-targets=all && make -k builds all files sucessfully, except m88k-tdep.c which needs unwinder updates. -- Pedro Alves --Boundary-00=_+1WrISG1AomioYI Content-Type: text/x-diff; charset="utf-8"; name="obj_section.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="obj_section.diff" Content-length: 6967 2008-08-21 Pedro Alves * arm-tdep.c (arm_pc_is_thumb): Use obj_section_addr. * hppa-hpux-tdep.c (hppa_hpux_find_dummy_bpaddr): Likewise. * hppa-linux-tdep.c (hppa_linux_find_global_pointer): Use obj_section_addr and obj_section_endaddr. * hppa-tdep.c (hppa64_convert_code_addr_to_fptr): Likewise. * hppabsd-tdep.c (hppabsd_find_global_pointer): Likewise. * ia64-tdep.c (ia64_find_global_pointer): Likewise. (find_extant_func_descr): Likewise. * solib-frv.c (frv_relocate_main_executable): Use obj_section_addr. * xstormy16-tdep.c (xstormy16_find_jmp_table_entry): Use obj_section_addr and obj_section_endaddr. --- gdb/arm-tdep.c | 3 ++- gdb/hppa-hpux-tdep.c | 4 ++-- gdb/hppa-linux-tdep.c | 8 +++++--- gdb/hppa-tdep.c | 10 ++++++---- gdb/hppabsd-tdep.c | 5 +++-- gdb/ia64-tdep.c | 16 ++++++++++------ gdb/solib-frv.c | 2 +- gdb/xstormy16-tdep.c | 9 ++++++--- 8 files changed, 35 insertions(+), 22 deletions(-) Index: src/gdb/arm-tdep.c =================================================================== --- src.orig/gdb/arm-tdep.c 2008-08-21 14:16:07.000000000 +0100 +++ src/gdb/arm-tdep.c 2008-08-21 14:17:12.000000000 +0100 @@ -303,7 +303,8 @@ arm_pc_is_thumb (CORE_ADDR memaddr) { struct arm_per_objfile *data; VEC(arm_mapping_symbol_s) *map; - struct arm_mapping_symbol map_key = { memaddr - sec->addr, 0 }; + struct arm_mapping_symbol map_key = { memaddr - obj_section_addr (sec), + 0 }; unsigned int idx; data = objfile_data (sec->objfile, arm_objfile_data_key); Index: src/gdb/hppa-hpux-tdep.c =================================================================== --- src.orig/gdb/hppa-hpux-tdep.c 2008-08-21 14:16:07.000000000 +0100 +++ src/gdb/hppa-hpux-tdep.c 2008-08-21 14:17:12.000000000 +0100 @@ -1068,9 +1068,9 @@ hppa_hpux_find_dummy_bpaddr (CORE_ADDR a { /* First try the lowest address in the section; we can use it as long as it is "regular" code (i.e. not a stub) */ - u = find_unwind_entry (sec->addr); + u = find_unwind_entry (obj_section_addr (sec)); if (!u || u->stub_unwind.stub_type == 0) - return sec->addr; + return obj_section_addr (sec); /* Otherwise, we need to find a symbol for a regular function. We do this by walking the list of msymbols in the objfile. The symbol Index: src/gdb/hppa-linux-tdep.c =================================================================== --- src.orig/gdb/hppa-linux-tdep.c 2008-08-21 14:16:07.000000000 +0100 +++ src/gdb/hppa-linux-tdep.c 2008-08-21 14:17:12.000000000 +0100 @@ -365,10 +365,12 @@ hppa_linux_find_global_pointer (struct g if (osect < faddr_sect->objfile->sections_end) { - CORE_ADDR addr; + CORE_ADDR addr, endaddr; - addr = osect->addr; - while (addr < osect->endaddr) + addr = obj_section_addr (osect); + endaddr = obj_section_endaddr (osect); + + while (addr < endaddr) { int status; LONGEST tag; Index: src/gdb/hppa-tdep.c =================================================================== --- src.orig/gdb/hppa-tdep.c 2008-08-21 14:16:07.000000000 +0100 +++ src/gdb/hppa-tdep.c 2008-08-21 14:17:12.000000000 +0100 @@ -912,15 +912,17 @@ hppa64_convert_code_addr_to_fptr (CORE_A ALL_OBJFILE_OSECTIONS (sec->objfile, opd) { if (strcmp (opd->the_bfd_section->name, ".opd") == 0) - break; + break; } if (opd < sec->objfile->sections_end) { CORE_ADDR addr; - for (addr = opd->addr; addr < opd->endaddr; addr += 2 * 8) - { + for (addr = obj_section_addr (opd); + addr < obj_section_endaddr (opd); + addr += 2 * 8) + { ULONGEST opdaddr; char tmp[8]; @@ -928,7 +930,7 @@ hppa64_convert_code_addr_to_fptr (CORE_A break; opdaddr = extract_unsigned_integer (tmp, sizeof (tmp)); - if (opdaddr == code) + if (opdaddr == code) return addr - 16; } } Index: src/gdb/hppabsd-tdep.c =================================================================== --- src.orig/gdb/hppabsd-tdep.c 2008-08-21 14:16:07.000000000 +0100 +++ src/gdb/hppabsd-tdep.c 2008-08-21 14:17:12.000000000 +0100 @@ -61,9 +61,10 @@ hppabsd_find_global_pointer (struct gdba if (sec < faddr_sec->objfile->sections_end) { - CORE_ADDR addr = sec->addr; + CORE_ADDR addr = obj_section_addr (sec); + CORE_ADDR endaddr = obj_section_endaddr (sec); - while (addr < sec->endaddr) + while (addr < endaddr) { gdb_byte buf[4]; LONGEST tag; Index: src/gdb/ia64-tdep.c =================================================================== --- src.orig/gdb/ia64-tdep.c 2008-08-21 14:16:07.000000000 +0100 +++ src/gdb/ia64-tdep.c 2008-08-21 14:17:12.000000000 +0100 @@ -3095,10 +3095,12 @@ ia64_find_global_pointer (CORE_ADDR fadd if (osect < faddr_sect->objfile->sections_end) { - CORE_ADDR addr; + CORE_ADDR addr, endaddr; - addr = osect->addr; - while (addr < osect->endaddr) + addr = obj_section_addr (osect); + endaddr = obj_section_endaddr (osect); + + while (addr < endaddr) { int status; LONGEST tag; @@ -3156,10 +3158,12 @@ find_extant_func_descr (CORE_ADDR faddr) if (osect < faddr_sect->objfile->sections_end) { - CORE_ADDR addr; + CORE_ADDR addr, endaddr; + + addr = obj_section_addr (osect); + endaddr = obj_section_endaddr (osect); - addr = osect->addr; - while (addr < osect->endaddr) + while (addr < endaddr) { int status; LONGEST faddr2; Index: src/gdb/solib-frv.c =================================================================== --- src.orig/gdb/solib-frv.c 2008-08-21 14:16:07.000000000 +0100 +++ src/gdb/solib-frv.c 2008-08-21 14:17:12.000000000 +0100 @@ -908,7 +908,7 @@ frv_relocate_main_executable (void) osect_idx = osect->the_bfd_section->index; /* Current address of section. */ - addr = osect->addr; + addr = obj_section_addr (osect); /* Offset from where this section started. */ offset = ANOFFSET (symfile_objfile->section_offsets, osect_idx); /* Original address prior to any past relocations. */ Index: src/gdb/xstormy16-tdep.c =================================================================== --- src.orig/gdb/xstormy16-tdep.c 2008-08-21 14:16:07.000000000 +0100 +++ src/gdb/xstormy16-tdep.c 2008-08-21 14:17:12.000000000 +0100 @@ -550,9 +550,12 @@ xstormy16_find_jmp_table_entry (CORE_ADD if (osect < faddr_sect->objfile->sections_end) { - CORE_ADDR addr; - for (addr = osect->addr; - addr < osect->endaddr; addr += 2 * xstormy16_inst_size) + CORE_ADDR addr, endaddr; + + addr = obj_section_addr (osect); + endaddr = obj_section_endaddr (osect); + + for (; addr < endaddr; addr += 2 * xstormy16_inst_size) { LONGEST inst, inst2, faddr2; char buf[2 * xstormy16_inst_size]; --Boundary-00=_+1WrISG1AomioYI--