summaryrefslogtreecommitdiff
path: root/gdb/hppa-bsd-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/hppa-bsd-tdep.c')
-rw-r--r--gdb/hppa-bsd-tdep.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/gdb/hppa-bsd-tdep.c b/gdb/hppa-bsd-tdep.c
index c8b044fdbfd..746956711b3 100644
--- a/gdb/hppa-bsd-tdep.c
+++ b/gdb/hppa-bsd-tdep.c
@@ -54,48 +54,45 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
faddr_sec = find_pc_section (faddr);
if (faddr_sec != NULL)
{
- struct obj_section *sec;
-
- ALL_OBJFILE_OSECTIONS (faddr_sec->objfile, sec)
+ for (struct obj_section *sec : faddr_sec->objfile->sections ())
{
if (strcmp (sec->the_bfd_section->name, ".dynamic") == 0)
- break;
- }
-
- if (sec < faddr_sec->objfile->sections_end)
- {
- CORE_ADDR addr = sec->addr ();
- CORE_ADDR endaddr = sec->endaddr ();
-
- while (addr < endaddr)
{
- gdb_byte buf[4];
- LONGEST tag;
-
- if (target_read_memory (addr, buf, sizeof buf) != 0)
- break;
+ CORE_ADDR addr = sec->addr ();
+ CORE_ADDR endaddr = sec->endaddr ();
- tag = extract_signed_integer (buf, byte_order);
- if (tag == DT_PLTGOT)
+ while (addr < endaddr)
{
- CORE_ADDR pltgot;
+ gdb_byte buf[4];
+ LONGEST tag;
- if (target_read_memory (addr + 4, buf, sizeof buf) != 0)
+ if (target_read_memory (addr, buf, sizeof buf) != 0)
break;
- /* The NetBSD/OpenBSD ld.so doesn't relocate DT_PLTGOT, so
- we have to do it ourselves. */
- pltgot = extract_unsigned_integer (buf, sizeof buf,
- byte_order);
- pltgot += sec->objfile->text_section_offset ();
+ tag = extract_signed_integer (buf, byte_order);
+ if (tag == DT_PLTGOT)
+ {
+ CORE_ADDR pltgot;
- return pltgot;
- }
+ if (target_read_memory (addr + 4, buf, sizeof buf) != 0)
+ break;
+
+ /* The NetBSD/OpenBSD ld.so doesn't relocate
+ DT_PLTGOT, so we have to do it ourselves. */
+ pltgot = extract_unsigned_integer (buf, sizeof buf,
+ byte_order);
+ pltgot += sec->objfile->text_section_offset ();
+
+ return pltgot;
+ }
- if (tag == DT_NULL)
- break;
+ if (tag == DT_NULL)
+ break;
+
+ addr += 8;
+ }
- addr += 8;
+ break;
}
}
}