#include "solib-svr4.h"
#include "osabi.h"
#include "mips-tdep.h"
-#include <string.h>
-#include "gdb_assert.h"
#include "frame.h"
#include "regcache.h"
#include "trad-frame.h"
mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *)gregs, regnum);
}
-static const struct regset *
-mips_linux_regset_from_core_section (struct gdbarch *gdbarch,
- const char *sect_name, size_t sect_size)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- mips_elf_gregset_t gregset;
- mips_elf_fpregset_t fpregset;
- mips64_elf_gregset_t gregset64;
- mips64_elf_fpregset_t fpregset64;
+static const struct regset mips_linux_gregset =
+ {
+ NULL, mips_supply_gregset_wrapper, mips_fill_gregset_wrapper
+ };
+
+static const struct regset mips64_linux_gregset =
+ {
+ NULL, mips64_supply_gregset_wrapper, mips64_fill_gregset_wrapper
+ };
+
+static const struct regset mips_linux_fpregset =
+ {
+ NULL, mips_supply_fpregset_wrapper, mips_fill_fpregset_wrapper
+ };
+
+static const struct regset mips64_linux_fpregset =
+ {
+ NULL, mips64_supply_fpregset_wrapper, mips64_fill_fpregset_wrapper
+ };
- if (strcmp (sect_name, ".reg") == 0)
+static void
+mips_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
+{
+ if (register_size (gdbarch, MIPS_ZERO_REGNUM) == 4)
{
- if (sect_size == sizeof (gregset))
- {
- if (tdep->gregset == NULL)
- tdep->gregset = regset_alloc (gdbarch,
- mips_supply_gregset_wrapper,
- mips_fill_gregset_wrapper);
- return tdep->gregset;
- }
- else if (sect_size == sizeof (gregset64))
- {
- if (tdep->gregset64 == NULL)
- tdep->gregset64 = regset_alloc (gdbarch,
- mips64_supply_gregset_wrapper,
- mips64_fill_gregset_wrapper);
- return tdep->gregset64;
- }
- else
- {
- warning (_("wrong size gregset struct in core file"));
- }
+ cb (".reg", sizeof (mips_elf_gregset_t), &mips_linux_gregset,
+ NULL, cb_data);
+ cb (".reg2", sizeof (mips_elf_fpregset_t), &mips_linux_fpregset,
+ NULL, cb_data);
}
- else if (strcmp (sect_name, ".reg2") == 0)
+ else
{
- if (sect_size == sizeof (fpregset))
- {
- if (tdep->fpregset == NULL)
- tdep->fpregset = regset_alloc (gdbarch,
- mips_supply_fpregset_wrapper,
- mips_fill_fpregset_wrapper);
- return tdep->fpregset;
- }
- else if (sect_size == sizeof (fpregset64))
- {
- if (tdep->fpregset64 == NULL)
- tdep->fpregset64 = regset_alloc (gdbarch,
- mips64_supply_fpregset_wrapper,
- mips64_fill_fpregset_wrapper);
- return tdep->fpregset64;
- }
- else
- {
- warning (_("wrong size fpregset struct in core file"));
- }
+ cb (".reg", sizeof (mips64_elf_gregset_t), &mips64_linux_gregset,
+ NULL, cb_data);
+ cb (".reg2", sizeof (mips64_elf_fpregset_t), &mips64_linux_fpregset,
+ NULL, cb_data);
}
-
- return NULL;
}
static const struct target_desc *
static CORE_ADDR
mips_linux_skip_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- struct minimal_symbol *resolver;
+ struct bound_minimal_symbol resolver;
resolver = lookup_minimal_symbol ("__dl_runtime_resolve", NULL, NULL);
- if (resolver && MSYMBOL_VALUE_ADDRESS (resolver) == pc)
+ if (resolver.minsym && BMSYMBOL_VALUE_ADDRESS (resolver) == pc)
return frame_unwind_caller_pc (get_current_frame ());
return glibc_skip_solib_resolver (gdbarch, pc);
set_gdbarch_core_read_description (gdbarch,
mips_linux_core_read_description);
- set_gdbarch_regset_from_core_section (gdbarch,
- mips_linux_regset_from_core_section);
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, mips_linux_iterate_over_regset_sections);
set_gdbarch_gdb_signal_from_target (gdbarch,
mips_gdb_signal_from_target);