GDBserver

Macros | Functions | Variables
spu-low.c File Reference
`#include "server.h"`
`#include "gdb_wait.h"`
`#include <sys/ptrace.h>`
`#include <fcntl.h>`
`#include <unistd.h>`
`#include <sys/syscall.h>`
`#include "filestuff.h"`
`#include "hostio.h"`
`#include "nat/fork-inferior.h"`

Go to the source code of this file.

## Macros
#define | __WNOTHREAD
#define | PTRACE_TYPE_RET long
#define | PTRACE_TYPE_ARG3 long
#define | SPU_NUM_REGS 130
#define | SPU_NUM_CORE_REGS 128
#define | SPU_ID_REGNUM 128
#define | SPU_PC_REGNUM 129
#define | INSTR_SC 0x44000002
#define | NR_spu_run 0x0116

## Functions
void | init_registers_spu (void)
static CORE_ADDR | fetch_ppc_register (int regno)
static int | fetch_ppc_memory_1 (int tid, CORE_ADDR memaddr, PTRACE_TYPE_RET *word)
static int | store_ppc_memory_1 (int tid, CORE_ADDR memaddr, PTRACE_TYPE_RET word)
static int | fetch_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len)
static int | store_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len)
static int | parse_spufs_run (int *fd, CORE_ADDR *addr)
static int | spu_proc_xfer_spu (const char *annex, unsigned char *readbuf, const unsigned char *writebuf, CORE_ADDR offset, int len)
static void | spu_ptrace_fun ()
static int | spu_create_inferior (const char *program, const std::vector< char *> &program_args)
int | spu_attach (unsigned long pid)
static int | spu_kill (int pid)
static int | spu_detach (int pid)
static void | spu_mourn (struct process_info *process)
static void | spu_join (int pid)
static int | spu_thread_alive (ptid_t ptid)
static void | spu_resume (struct thread_resume *resume_info, size_t n)
static ptid_t | spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
static void | spu_fetch_registers (struct regcache *regcache, int regno)
static void | spu_store_registers (struct regcache *regcache, int regno)
static int | spu_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
static int | spu_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len)
static void | spu_look_up_symbols (void)
static void | spu_request_interrupt (void)
static const gdb_byte * | spu_sw_breakpoint_from_kind (int kind, int *size)
void | initialize_low (void)

## Variables
int | using_threads = 0
const struct target_desc * | tdesc_spu
static const gdb_byte | breakpoint [] = { 0x00, 0x00, 0x3f, 0xff }
static struct target_ops | spu_target_ops

## Macro Definition Documentation

## ◆ __WNOTHREAD

#define __WNOTHREAD

Value:
0x20000000 /* Don't wait on children of other
threads in this group */

Definition at line 34 of file spu-low.c.

Referenced by spu_wait().

## ◆ INSTR_SC

#define INSTR_SC 0x44000002

Definition at line 50 of file spu-low.c.

Referenced by parse_spufs_run().

## ◆ NR_spu_run

#define NR_spu_run 0x0116

Definition at line 51 of file spu-low.c.

Referenced by parse_spufs_run().

## ◆ PTRACE_TYPE_ARG3

#define PTRACE_TYPE_ARG3 long

Definition at line 39 of file spu-low.c.

Referenced by fetch_ppc_memory_1(), fetch_ppc_register(), spu_wait(), and store_ppc_memory_1().

## ◆ PTRACE_TYPE_RET

#define PTRACE_TYPE_RET long

Definition at line 38 of file spu-low.c.

Referenced by fetch_ppc_memory(), fetch_ppc_register(), and store_ppc_memory().

## ◆ SPU_ID_REGNUM

#define SPU_ID_REGNUM 128

Definition at line 46 of file spu-low.c.

Referenced by spu_fetch_registers().

## ◆ SPU_NUM_CORE_REGS

#define SPU_NUM_CORE_REGS 128

Definition at line 43 of file spu-low.c.

Referenced by spu_fetch_registers(), and spu_store_registers().

## ◆ SPU_NUM_REGS

#define SPU_NUM_REGS 130

Definition at line 42 of file spu-low.c.

## ◆ SPU_PC_REGNUM

#define SPU_PC_REGNUM 129

Definition at line 47 of file spu-low.c.

Referenced by spu_fetch_registers(), and spu_store_registers().

## Function Documentation

## ◆ fetch_ppc_memory()

static int fetch_ppc_memory | ( | CORE_ADDR | memaddr,
|  | char * | myaddr,
|  | int | len
| ) |  |
| static

Definition at line 145 of file spu-low.c.

References current_ptid, fetch_ppc_memory_1(), ptid_get_lwp(), and PTRACE_TYPE_RET.

Referenced by parse_spufs_run(), and spu_fetch_registers().

## ◆ fetch_ppc_memory_1()

static int fetch_ppc_memory_1 | ( | int | tid,
|  | CORE_ADDR | memaddr,
|  | PTRACE_TYPE_RET * | word
| ) |  |
| static

Definition at line 105 of file spu-low.c.

References errno, PT_READ_I, ptrace(), PTRACE_TYPE_ARG1, and PTRACE_TYPE_ARG3.

Referenced by fetch_ppc_memory(), and store_ppc_memory().

## ◆ fetch_ppc_register()

static CORE_ADDR fetch_ppc_register | ( | int | regno | ) |
| static

Definition at line 65 of file spu-low.c.

References current_ptid, errno, perror_with_name(), PT_READ_U, ptid_get_lwp(), ptrace(), PTRACE_TYPE_ARG1, PTRACE_TYPE_ARG3, and PTRACE_TYPE_RET.

Referenced by parse_spufs_run().

## ◆ init_registers_spu()

void init_registers_spu | ( | void |  | ) |

Referenced by initialize_low().

## ◆ initialize_low()

void initialize_low | ( | void |  | ) |

Definition at line 735 of file spu-low.c.

References init_registers_spu(), set_target_ops(), and spu_target_ops.

## ◆ parse_spufs_run()

static int parse_spufs_run | ( | int * | fd,
|  | CORE_ADDR * | addr
| ) |  |
| static

Definition at line 208 of file spu-low.c.

References fetch_ppc_memory(), fetch_ppc_register(), INSTR_SC, and NR_spu_run.

Referenced by spu_fetch_registers(), spu_read_memory(), spu_store_registers(), spu_wait(), and spu_write_memory().

## ◆ spu_attach()

int spu_attach | ( | unsigned long | pid | ) |

Definition at line 307 of file spu-low.c.

References add_process(), add_thread(), errno, process_info::pid, ptid_build(), ptrace(), strerror(), process_info::tdesc, and tdesc_spu.

## ◆ spu_create_inferior()

static int spu_create_inferior | ( | const char * | program,
|  | const std::vector< char *> & | program_args
| ) |  |
| static

Definition at line 282 of file spu-low.c.

References add_process(), add_thread(), gdb_environ::envp(), fork_inferior(), get_environ(), process_info::pid, post_fork_inferior(), program_args, ptid_build(), spu_ptrace_fun(), string, stringify_argv(), process_info::tdesc, and tdesc_spu.

## ◆ spu_detach()

static int spu_detach | ( | int | pid | ) |
| static

Definition at line 351 of file spu-low.c.

References clear_inferiors(), find_process_pid(), process_info::pid, ptrace(), and remove_process().

## ◆ spu_fetch_registers()

static void spu_fetch_registers | ( | struct regcache * | regcache,
|  | int | regno
| ) |  |
| static

Definition at line 487 of file spu-low.c.

References fetch_ppc_memory(), parse_spufs_run(), SPU_ID_REGNUM, SPU_NUM_CORE_REGS, SPU_PC_REGNUM, spu_proc_xfer_spu(), and supply_register().

## ◆ spu_join()

static void spu_join | ( | int | pid | ) |
| static

Definition at line 371 of file spu-low.c.

References errno, process_info::pid, WIFEXITED, and WIFSIGNALED.

## ◆ spu_kill()

static int spu_kill | ( | int | pid | ) |
| static

Definition at line 329 of file spu-low.c.

References clear_inferiors(), errno, find_process_pid(), process_info::pid, ptrace(), remove_process(), WIFEXITED, and WIFSIGNALED.

## ◆ spu_look_up_symbols()

static void spu_look_up_symbols | ( | void |  | ) |
| static

Definition at line 636 of file spu-low.c.

## ◆ spu_mourn()

static void spu_mourn | ( | struct process_info * | process | ) |
| static

Definition at line 365 of file spu-low.c.

References remove_process().

## ◆ spu_proc_xfer_spu()

static int spu_proc_xfer_spu | ( | const char * | annex,
|  | unsigned char * | readbuf,
|  | const unsigned char * | writebuf,
|  | CORE_ADDR | offset,
|  | int | len
| ) |  |
| static

Definition at line 233 of file spu-low.c.

References current_ptid, offset, and ptid_get_lwp().

Referenced by spu_fetch_registers(), spu_read_memory(), spu_store_registers(), and spu_write_memory().

## ◆ spu_ptrace_fun()

static void spu_ptrace_fun | ( |  | ) |
| static

Definition at line 269 of file spu-low.c.

References ptrace(), and trace_start_error_with_name().

Referenced by spu_create_inferior().

## ◆ spu_read_memory()

static int spu_read_memory | ( | CORE_ADDR | memaddr,
|  | unsigned char * | myaddr,
|  | int | len
| ) |  |
| static

Definition at line 563 of file spu-low.c.

References memset(), parse_spufs_run(), and spu_proc_xfer_spu().

## ◆ spu_request_interrupt()

static void spu_request_interrupt | ( | void |  | ) |
| static

Definition at line 642 of file spu-low.c.

References get_first_thread(), and lwpid_of().

## ◆ spu_resume()

static void spu_resume | ( | struct thread_resume * | resume_info,
|  | size_t | n
| ) |  |
| static

Definition at line 391 of file spu-low.c.

References errno, get_first_thread(), minus_one_ptid, perror_with_name(), ptid_equal(), ptid_get_lwp(), ptid_of(), ptrace(), and regcache_invalidate().

## ◆ spu_store_registers()

static void spu_store_registers | ( | struct regcache * | regcache,
|  | int | regno
| ) |  |
| static

Definition at line 524 of file spu-low.c.

References collect_register(), parse_spufs_run(), SPU_NUM_CORE_REGS, SPU_PC_REGNUM, spu_proc_xfer_spu(), and store_ppc_memory().

## ◆ spu_sw_breakpoint_from_kind()

static const gdb_byte* spu_sw_breakpoint_from_kind | ( | int | kind,
|  | int * | size
| ) |  |
| static

Definition at line 652 of file spu-low.c.

References breakpoint.

## ◆ spu_thread_alive()

static int spu_thread_alive | ( | ptid_t | ptid | ) |
| static

Definition at line 384 of file spu-low.c.

References current_ptid, and ptid_equal().

## ◆ spu_wait()

static ptid_t spu_wait | ( | ptid_t | ptid,
|  | struct target_waitstatus * | ourstatus,
|  | int | options
| ) |  |
| static

Definition at line 419 of file spu-low.c.

References __WALL, __WNOTHREAD, clear_inferiors(), errno, gdb_signal_from_host(), parse_spufs_run(), perror_with_name(), pid_to_ptid(), PT_SYSCALL, ptid_build(), ptid_get_pid(), ptrace(), PTRACE_TYPE_ARG3, server_waiting, WEXITSTATUS, WIFEXITED, WIFSTOPPED, WNOHANG, WSTOPSIG, and WTERMSIG.

## ◆ spu_write_memory()

static int spu_write_memory | ( | CORE_ADDR | memaddr,
|  | const unsigned char * | myaddr,
|  | int | len
| ) |  |
| static

Definition at line 601 of file spu-low.c.

References memset(), parse_spufs_run(), and spu_proc_xfer_spu().

## ◆ store_ppc_memory()

static int store_ppc_memory | ( | CORE_ADDR | memaddr,
|  | char * | myaddr,
|  | int | len
| ) |  |
| static

Definition at line 170 of file spu-low.c.

References current_ptid, fetch_ppc_memory_1(), ptid_get_lwp(), PTRACE_TYPE_RET, and store_ppc_memory_1().

Referenced by spu_store_registers().

## ◆ store_ppc_memory_1()

static int store_ppc_memory_1 | ( | int | tid,
|  | CORE_ADDR | memaddr,
|  | PTRACE_TYPE_RET | word
| ) |  |
| static

Definition at line 125 of file spu-low.c.

References errno, PT_WRITE_D, ptrace(), PTRACE_TYPE_ARG1, and PTRACE_TYPE_ARG3.

Referenced by store_ppc_memory().

## Variable Documentation

## ◆ breakpoint

const gdb_byte breakpoint[] = { 0x00, 0x00, 0x3f, 0xff }
| static

Definition at line 61 of file spu-low.c.

Referenced by spu_sw_breakpoint_from_kind().

## ◆ spu_target_ops

struct target_ops spu_target_ops
| static

Definition at line 658 of file spu-low.c.

Referenced by initialize_low().

## ◆ tdesc_spu

const struct target_desc* tdesc_spu

Referenced by spu_attach(), and spu_create_inferior().

## ◆ using_threads

int using_threads = 0

Definition at line 54 of file spu-low.c.