Changeset View
Changeset View
Standalone View
Standalone View
devel/gdb/files/kgdb/ppcfbsd-kern.c
Show All 21 Lines | |||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/types.h> | #include "defs.h" | ||||
#ifdef __powerpc__ | #include "frame-unwind.h" | ||||
#include <machine/pcb.h> | |||||
#include <machine/frame.h> | |||||
#endif | |||||
#include <string.h> | |||||
#include <defs.h> | |||||
#include <frame-unwind.h> | |||||
#include "gdbcore.h" | #include "gdbcore.h" | ||||
#include "osabi.h" | #include "osabi.h" | ||||
#include "regcache.h" | #include "regcache.h" | ||||
#include "solib.h" | #include "solib.h" | ||||
#include "symtab.h" | #include "symtab.h" | ||||
#include "trad-frame.h" | #include "trad-frame.h" | ||||
#include "ppc-tdep.h" | |||||
#include <ppc-tdep.h> | |||||
#include "ppc64-tdep.h" | #include "ppc64-tdep.h" | ||||
#ifdef __powerpc__ | |||||
#include <machine/pcb.h> | |||||
#include <machine/frame.h> | |||||
#endif | |||||
#include "kgdb.h" | #include "kgdb.h" | ||||
#ifdef __powerpc__ | #ifdef __powerpc__ | ||||
static void | static void | ||||
ppcfbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr) | ppcfbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr) | ||||
{ | { | ||||
struct pcb pcb; | struct pcb pcb; | ||||
struct gdbarch_tdep *tdep; | struct gdbarch_tdep *tdep; | ||||
int i; | int i; | ||||
tdep = gdbarch_tdep (target_gdbarch()); | tdep = gdbarch_tdep (regcache->arch ()); | ||||
if (target_read_memory(pcb_addr, (gdb_byte *)&pcb, sizeof(pcb)) != 0) | if (target_read_memory(pcb_addr, (gdb_byte *)&pcb, sizeof(pcb)) != 0) | ||||
memset(&pcb, 0, sizeof(pcb)); | memset(&pcb, 0, sizeof(pcb)); | ||||
/* | /* | ||||
* r14-r31 are saved in the pcb | * r14-r31 are saved in the pcb | ||||
*/ | */ | ||||
for (i = 14; i <= 31; i++) { | for (i = 14; i <= 31; i++) { | ||||
regcache_raw_supply(regcache, tdep->ppc_gp0_regnum + i, | regcache->raw_supply(tdep->ppc_gp0_regnum + i, | ||||
(char *)&pcb.pcb_context[i]); | (char *)&pcb.pcb_context[i]); | ||||
} | } | ||||
/* r1 is saved in the sp field */ | /* r1 is saved in the sp field */ | ||||
regcache_raw_supply(regcache, tdep->ppc_gp0_regnum + 1, | regcache->raw_supply(tdep->ppc_gp0_regnum + 1, | ||||
(char *)&pcb.pcb_sp); | (char *)&pcb.pcb_sp); | ||||
if (tdep->wordsize == 8) | if (tdep->wordsize == 8) | ||||
/* r2 is saved in the toc field */ | /* r2 is saved in the toc field */ | ||||
regcache_raw_supply(regcache, tdep->ppc_gp0_regnum + 2, | regcache->raw_supply(tdep->ppc_gp0_regnum + 2, | ||||
(char *)&pcb.pcb_toc); | (char *)&pcb.pcb_toc); | ||||
regcache_raw_supply(regcache, tdep->ppc_lr_regnum, (char *)&pcb.pcb_lr); | regcache->raw_supply(tdep->ppc_lr_regnum, (char *)&pcb.pcb_lr); | ||||
regcache_raw_supply(regcache, tdep->ppc_cr_regnum, (char *)&pcb.pcb_cr); | regcache->raw_supply(tdep->ppc_cr_regnum, (char *)&pcb.pcb_cr); | ||||
} | } | ||||
#endif | #endif | ||||
#define OFF_FIXREG 0 | #define OFF_FIXREG 0 | ||||
#define OFF_LR 32 | #define OFF_LR 32 | ||||
#define OFF_CR 33 | #define OFF_CR 33 | ||||
#define OFF_XER 34 | #define OFF_XER 34 | ||||
#define OFF_CTR 35 | #define OFF_CTR 35 | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | #endif | ||||
if (tdep->wordsize == 8) | if (tdep->wordsize == 8) | ||||
{ | { | ||||
set_gdbarch_convert_from_func_ptr_addr | set_gdbarch_convert_from_func_ptr_addr | ||||
(gdbarch, ppc64_convert_from_func_ptr_addr); | (gdbarch, ppc64_convert_from_func_ptr_addr); | ||||
set_gdbarch_elf_make_msymbol_special (gdbarch, | set_gdbarch_elf_make_msymbol_special (gdbarch, | ||||
ppc64_elf_make_msymbol_special); | ppc64_elf_make_msymbol_special); | ||||
} | } | ||||
} | } | ||||
void _initialize_ppc_kgdb_tdep(void); | |||||
void | void | ||||
_initialize_ppc_kgdb_tdep(void) | _initialize_ppc_kgdb_tdep(void) | ||||
{ | { | ||||
gdbarch_register_osabi_sniffer(bfd_arch_powerpc, | gdbarch_register_osabi_sniffer(bfd_arch_powerpc, | ||||
bfd_target_elf_flavour, | bfd_target_elf_flavour, | ||||
fbsd_kernel_osabi_sniffer); | fbsd_kernel_osabi_sniffer); | ||||
gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, | gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, | ||||
Show All 11 Lines |