1/* 2 * Copyright (c) 2004 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h>
| 1/* 2 * Copyright (c) 2004 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h>
|
28__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c 132624 2004-07-25 05:29:15Z marcel $");
| 28__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c 142151 2005-02-20 22:55:07Z kan $");
|
29 30#include <sys/types.h> 31#include <machine/asm.h> 32#include <machine/pcb.h> 33#include <err.h> 34#include <kvm.h> 35#include <string.h> 36 37#include "kgdb.h" 38 39#include <defs.h> 40#include <target.h> 41#include <gdbthread.h> 42#include <inferior.h> 43#include <regcache.h> 44 45void 46kgdb_trgt_fetch_registers(int regno __unused) 47{ 48 struct kthr *kt; 49 struct pcb pcb; 50 uint64_t r; 51
| 29 30#include <sys/types.h> 31#include <machine/asm.h> 32#include <machine/pcb.h> 33#include <err.h> 34#include <kvm.h> 35#include <string.h> 36 37#include "kgdb.h" 38 39#include <defs.h> 40#include <target.h> 41#include <gdbthread.h> 42#include <inferior.h> 43#include <regcache.h> 44 45void 46kgdb_trgt_fetch_registers(int regno __unused) 47{ 48 struct kthr *kt; 49 struct pcb pcb; 50 uint64_t r; 51
|
52 kt = kgdb_thr_lookup(ptid_get_pid(inferior_ptid));
| 52 kt = kgdb_thr_lookup_tid(ptid_get_tid(inferior_ptid));
|
53 if (kt == NULL) 54 return; 55 if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) { 56 warnx("kvm_read: %s", kvm_geterr(kvm)); 57 memset(&pcb, 0, sizeof(pcb)); 58 } 59 60 /* 0-7: global registers (g0-g7) */ 61 62 /* 8-15: output registers (o0-o7) */ 63 r = pcb.pcb_sp - CCFSZ; 64 supply_register(14, (char *)&r); 65 66 /* 16-23: local registers (l0-l7) */ 67 68 /* 24-31: input registers (i0-i7) */ 69 supply_register(30, (char *)&pcb.pcb_sp); 70 71 /* 32-63: single precision FP (f0-f31) */ 72 73 /* 64-79: double precision FP (f32-f62) */ 74 supply_register(80, (char *)&pcb.pcb_pc); 75} 76 77void 78kgdb_trgt_store_registers(int regno __unused) 79{ 80 fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__); 81}
| 53 if (kt == NULL) 54 return; 55 if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) { 56 warnx("kvm_read: %s", kvm_geterr(kvm)); 57 memset(&pcb, 0, sizeof(pcb)); 58 } 59 60 /* 0-7: global registers (g0-g7) */ 61 62 /* 8-15: output registers (o0-o7) */ 63 r = pcb.pcb_sp - CCFSZ; 64 supply_register(14, (char *)&r); 65 66 /* 16-23: local registers (l0-l7) */ 67 68 /* 24-31: input registers (i0-i7) */ 69 supply_register(30, (char *)&pcb.pcb_sp); 70 71 /* 32-63: single precision FP (f0-f31) */ 72 73 /* 64-79: double precision FP (f32-f62) */ 74 supply_register(80, (char *)&pcb.pcb_pc); 75} 76 77void 78kgdb_trgt_store_registers(int regno __unused) 79{ 80 fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__); 81}
|