summaryrefslogtreecommitdiff
path: root/gdb/ia64-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/ia64-tdep.c')
-rw-r--r--gdb/ia64-tdep.c99
1 files changed, 48 insertions, 51 deletions
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 37e5ce95539..27da839e27d 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -3431,48 +3431,47 @@ ia64_find_global_pointer_from_dynamic_section (struct gdbarch *gdbarch,
faddr_sect = find_pc_section (faddr);
if (faddr_sect != NULL)
{
- struct obj_section *osect;
-
- ALL_OBJFILE_OSECTIONS (faddr_sect->objfile, osect)
+ for (obj_section *osect : faddr_sect->objfile->sections ())
{
if (strcmp (osect->the_bfd_section->name, ".dynamic") == 0)
- break;
- }
-
- if (osect < faddr_sect->objfile->sections_end)
- {
- CORE_ADDR addr = osect->addr ();
- CORE_ADDR endaddr = osect->endaddr ();
-
- while (addr < endaddr)
{
- int status;
- LONGEST tag;
- gdb_byte buf[8];
+ CORE_ADDR addr = osect->addr ();
+ CORE_ADDR endaddr = osect->endaddr ();
- status = target_read_memory (addr, buf, sizeof (buf));
- if (status != 0)
- break;
- tag = extract_signed_integer (buf, byte_order);
-
- if (tag == DT_PLTGOT)
+ while (addr < endaddr)
{
- CORE_ADDR global_pointer;
+ int status;
+ LONGEST tag;
+ gdb_byte buf[8];
- status = target_read_memory (addr + 8, buf, sizeof (buf));
+ status = target_read_memory (addr, buf, sizeof (buf));
if (status != 0)
break;
- global_pointer = extract_unsigned_integer (buf, sizeof (buf),
- byte_order);
+ tag = extract_signed_integer (buf, byte_order);
- /* The payoff... */
- return global_pointer;
- }
+ if (tag == DT_PLTGOT)
+ {
+ CORE_ADDR global_pointer;
+
+ status = target_read_memory (addr + 8, buf,
+ sizeof (buf));
+ if (status != 0)
+ break;
+ global_pointer
+ = extract_unsigned_integer (buf, sizeof (buf),
+ byte_order);
+
+ /* The payoff... */
+ return global_pointer;
+ }
+
+ if (tag == DT_NULL)
+ break;
- if (tag == DT_NULL)
- break;
+ addr += 16;
+ }
- addr += 16;
+ break;
}
}
}
@@ -3513,33 +3512,31 @@ find_extant_func_descr (struct gdbarch *gdbarch, CORE_ADDR faddr)
if (faddr_sect != NULL)
{
- struct obj_section *osect;
- ALL_OBJFILE_OSECTIONS (faddr_sect->objfile, osect)
+ for (obj_section *osect : faddr_sect->objfile->sections ())
{
if (strcmp (osect->the_bfd_section->name, ".opd") == 0)
- break;
- }
+ {
+ CORE_ADDR addr = osect->addr ();
+ CORE_ADDR endaddr = osect->endaddr ();
- if (osect < faddr_sect->objfile->sections_end)
- {
- CORE_ADDR addr = osect->addr ();
- CORE_ADDR endaddr = osect->endaddr ();
+ while (addr < endaddr)
+ {
+ int status;
+ LONGEST faddr2;
+ gdb_byte buf[8];
- while (addr < endaddr)
- {
- int status;
- LONGEST faddr2;
- gdb_byte buf[8];
+ status = target_read_memory (addr, buf, sizeof (buf));
+ if (status != 0)
+ break;
+ faddr2 = extract_signed_integer (buf, byte_order);
- status = target_read_memory (addr, buf, sizeof (buf));
- if (status != 0)
- break;
- faddr2 = extract_signed_integer (buf, byte_order);
+ if (faddr == faddr2)
+ return addr;
- if (faddr == faddr2)
- return addr;
+ addr += 16;
+ }
- addr += 16;
+ break;
}
}
}