Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] Remove addr, endaddr, offset from obj_section
Date: Thu, 21 Aug 2008 13:28:00 -0000	[thread overview]
Message-ID: <200808211428.30553.pedro@codesourcery.com> (raw)
In-Reply-To: <200808201223.17427.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

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

[-- Attachment #2: obj_section.diff --]
[-- Type: text/x-diff, Size: 6967 bytes --]

2008-08-21  Pedro Alves  <pedro@codesourcery.com>

	* 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];

  reply	other threads:[~2008-08-21 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16 20:42 Pedro Alves
2008-05-17  0:11 ` Ulrich Weigand
2008-05-17  2:17   ` Pedro Alves
2008-06-05 19:16 ` Daniel Jacobowitz
2008-08-20 11:23   ` Pedro Alves
2008-08-21 13:28     ` Pedro Alves [this message]
2008-09-02  9:33       ` Andreas Schwab
2008-09-02 21:09         ` Joel Brobecker

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=200808211428.30553.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.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