#include "target-descriptions.h"
#include "user-regs.h"
#include "observer.h"
+#include "infcall.h"
#include "arm-tdep.h"
#include "gdb/sim-arm.h"
si = pop_stack_item (si);
}
+ if (gdbarch_tdep (gdbarch)->is_fdpic)
+ {
+ CORE_ADDR func_addr = find_function_addr (function, NULL);
+
+ regcache_cooked_write_unsigned (regcache, 9,
+ fdpic_find_global_pointer (func_addr));
+ }
+
/* Finally, update teh SP register. */
regcache_cooked_write_unsigned (regcache, ARM_SP_REGNUM, sp);
/* FDPIC structure and api. */
extern struct target_so_ops fdpic_so_ops;
extern CORE_ADDR fdpic_fetch_objfile_link_map (struct objfile *objfile);
+extern CORE_ADDR fdpic_find_global_pointer (CORE_ADDR addr);
#endif /* arm-tdep.h */
return 0;
}
+/* Exported functions. */
+/* Find the global pointer for the given function address ADDR. */
+CORE_ADDR
+fdpic_find_global_pointer (CORE_ADDR addr)
+{
+ struct so_list *so;
+
+ so = master_so_list ();
+ while (so)
+ {
+ int seg;
+ struct elf32_fdpic_loadmap *map;
+
+ map = so->lm_info->map;
+
+ for (seg = 0; seg < map->nsegs; seg++)
+ {
+ if (map->segs[seg].addr <= addr
+ && addr < map->segs[seg].addr + map->segs[seg].p_memsz)
+ return so->lm_info->got_value;
+ }
+
+ so = so->next;
+ }
+
+ /* Didn't find it in any of the shared objects.
+ So assume it's in the main executable. */
+ return main_got ();
+}
+
/* Shared object operations. */
static int
fdpic_in_dynsym_resolve_code (CORE_ADDR pc)