GDBserver

Classes | Macros | Functions | Variables
linux-mips-low.c File Reference
`#include "server.h"`
`#include "linux-low.h"`
`#include "nat/gdb_ptrace.h"`
`#include <endian.h>`
`#include "nat/mips-linux-watch.h"`
`#include "gdb_proc_service.h"`
`#include <asm/ptrace.h>`

Go to the source code of this file.

## Classes
union | mips_register
struct | arch_process_info
struct | arch_lwp_info

## Macros
#define | PTRACE_GET_THREAD_AREA 25
#define | mips_num_regs 73
#define | mips_dsp_num_regs 80
#define | DSP_BASE 71
#define | DSP_CONTROL 77
#define | mips_base_regs
#define | mips_dsp_regs
#define | mips_breakpoint_len 4

## Functions
void | init_registers_mips_linux (void)
void | init_registers_mips_dsp_linux (void)
void | init_registers_mips64_linux (void)
void | init_registers_mips64_dsp_linux (void)
static const struct target_desc * | mips_read_description (void)
static void | mips_arch_setup (void)
static struct usrregs_info * | get_usrregs_info (void)
static int | mips_cannot_fetch_register (int regno)
static int | mips_cannot_store_register (int regno)
static CORE_ADDR | mips_get_pc (struct regcache *regcache)
static void | mips_set_pc (struct regcache *regcache, CORE_ADDR pc)
static const gdb_byte * | mips_sw_breakpoint_from_kind (int kind, int *size)
static int | mips_breakpoint_at (CORE_ADDR where)
static void | update_watch_registers_callback (thread_info *thread)
static struct arch_process_info * | mips_linux_new_process (void)
static void | mips_linux_delete_process (struct arch_process_info *info)
static void | mips_linux_new_thread (struct lwp_info *lwp)
static void | mips_linux_delete_thread (struct arch_lwp_info *arch_lwp)
static void | mips_add_watchpoint (struct arch_process_info *priv, CORE_ADDR addr, int len, enum target_hw_bp_type watch_type)
static void | mips_linux_new_fork (struct process_info *parent, struct process_info *child)
static void | mips_linux_prepare_to_resume (struct lwp_info *lwp)
static int | mips_supports_z_point_type (char z_type)
static int | mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
static int | mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
static int | mips_stopped_by_watchpoint (void)
static CORE_ADDR | mips_stopped_data_address (void)
ps_err_e | ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static const struct regs_info * | mips_regs_info (void)
void | initialize_low_arch (void)

## Variables
const struct target_desc * | tdesc_mips_linux
const struct target_desc * | tdesc_mips_dsp_linux
const struct target_desc * | tdesc_mips64_linux
const struct target_desc * | tdesc_mips64_dsp_linux
static int | mips_regmap [mips_num_regs]
static int | mips_dsp_regmap [mips_dsp_num_regs]
static unsigned char | mips_dsp_regset_bitmap [(mips_dsp_num_regs+7)/8]
static int | have_dsp = -1
static const unsigned int | mips_breakpoint = 0x0005000d
static struct regset_info | mips_regsets []
static struct regsets_info | mips_regsets_info
static struct usrregs_info | mips_dsp_usrregs_info
static struct usrregs_info | mips_usrregs_info
static struct regs_info | dsp_regs_info
static struct regs_info | regs_info
struct linux_target_ops | the_low_target

## Macro Definition Documentation

## ◆ DSP_BASE

#define DSP_BASE 71

Definition at line 63 of file linux-mips-low.c.

## ◆ DSP_CONTROL

#define DSP_CONTROL 77

Definition at line 64 of file linux-mips-low.c.

Referenced by mips_read_description().

## ◆ mips_base_regs

#define mips_base_regs

Value:
-1, 1, 2, 3, 4, 5, 6, 7, \
8, 9, 10, 11, 12, 13, 14, 15, \
16, 17, 18, 19, 20, 21, 22, 23, \
24, 25, 26, 27, 28, 29, 30, 31, \
\
-1, MMLO, MMHI, BADVADDR, CAUSE, PC, \
\
FPR_BASE, FPR_BASE + 1, FPR_BASE + 2, FPR_BASE + 3, \
FPR_BASE + 4, FPR_BASE + 5, FPR_BASE + 6, FPR_BASE + 7, \
FPR_BASE + 8, FPR_BASE + 9, FPR_BASE + 10, FPR_BASE + 11, \
FPR_BASE + 12, FPR_BASE + 13, FPR_BASE + 14, FPR_BASE + 15, \
FPR_BASE + 16, FPR_BASE + 17, FPR_BASE + 18, FPR_BASE + 19, \
FPR_BASE + 20, FPR_BASE + 21, FPR_BASE + 22, FPR_BASE + 23, \
FPR_BASE + 24, FPR_BASE + 25, FPR_BASE + 26, FPR_BASE + 27, \
FPR_BASE + 28, FPR_BASE + 29, FPR_BASE + 30, FPR_BASE + 31, \
FPC_CSR, FPC_EIR

Definition at line 78 of file linux-mips-low.c.

## ◆ mips_breakpoint_len

#define mips_breakpoint_len 4

Definition at line 267 of file linux-mips-low.c.

Referenced by mips_sw_breakpoint_from_kind().

## ◆ mips_dsp_num_regs

#define mips_dsp_num_regs 80

Definition at line 58 of file linux-mips-low.c.

## ◆ mips_dsp_regs

#define mips_dsp_regs

Value:
DSP_BASE, DSP_BASE + 1, DSP_BASE + 2, DSP_BASE + 3, \
DSP_BASE + 4, DSP_BASE + 5, \
DSP_CONTROL
DSP_BASE
#define DSP_BASE
Definition: linux-mips-low.c:63

Definition at line 96 of file linux-mips-low.c.

## ◆ mips_num_regs

#define mips_num_regs 73

Definition at line 57 of file linux-mips-low.c.

## ◆ PTRACE_GET_THREAD_AREA

#define PTRACE_GET_THREAD_AREA 25

Definition at line 50 of file linux-mips-low.c.

Referenced by ps_get_thread_area().

## Function Documentation

## ◆ get_usrregs_info()

static struct usrregs_info* get_usrregs_info | ( | void |  | ) |
| static

Definition at line 157 of file linux-mips-low.c.

References linux_target_ops::regs_info, the_low_target, and regs_info::usrregs.

Referenced by mips_cannot_fetch_register(), and mips_cannot_store_register().

## ◆ init_registers_mips64_dsp_linux()

void init_registers_mips64_dsp_linux | ( | void |  | ) |

Referenced by initialize_low_arch().

## ◆ init_registers_mips64_linux()

void init_registers_mips64_linux | ( | void |  | ) |

Referenced by initialize_low_arch().

## ◆ init_registers_mips_dsp_linux()

void init_registers_mips_dsp_linux | ( | void |  | ) |

Referenced by initialize_low_arch().

## ◆ init_registers_mips_linux()

void init_registers_mips_linux | ( | void |  | ) |

Referenced by initialize_low_arch().

## ◆ initialize_low_arch()

void initialize_low_arch | ( | void |  | ) |

Definition at line 907 of file linux-mips-low.c.

References init_registers_mips64_dsp_linux(), init_registers_mips64_linux(), init_registers_mips_dsp_linux(), init_registers_mips_linux(), and mips_regsets_info.

## ◆ mips_add_watchpoint()

static void mips_add_watchpoint | ( | struct arch_process_info * | priv,
|  | CORE_ADDR | addr,
|  | int | len,
|  | enum target_hw_bp_type | watch_type
| ) |  |
| static

Definition at line 354 of file linux-mips-low.c.

References mips_watchpoint::addr, arch_process_info::current_watches, mips_watchpoint::len, mips_watchpoint::next, mips_watchpoint::type, and XNEW.

Referenced by mips_insert_point(), and mips_linux_new_fork().

## ◆ mips_arch_setup()

static void mips_arch_setup | ( | void |  | ) |
| static

Definition at line 151 of file linux-mips-low.c.

References current_process(), mips_read_description(), and process_info::tdesc.

## ◆ mips_breakpoint_at()

static int mips_breakpoint_at | ( | CORE_ADDR | where | ) |
| static

Definition at line 279 of file linux-mips-low.c.

References mips_breakpoint, target_ops::read_memory, and the_target.

## ◆ mips_cannot_fetch_register()

static int mips_cannot_fetch_register | ( | int | regno | ) |
| static

Definition at line 205 of file linux-mips-low.c.

References current_process(), find_regno(), get_usrregs_info(), and process_info::tdesc.

## ◆ mips_cannot_store_register()

static int mips_cannot_store_register | ( | int | regno | ) |
| static

Definition at line 221 of file linux-mips-low.c.

References current_process(), find_regno(), get_usrregs_info(), and process_info::tdesc.

## ◆ mips_get_pc()

static CORE_ADDR mips_get_pc | ( | struct regcache * | regcache | ) |
| static

Definition at line 246 of file linux-mips-low.c.

References mips_register::buf, collect_register_by_name(), mips_register::reg32, mips_register::reg64, register_size(), and regcache::tdesc.

## ◆ mips_insert_point()

static int mips_insert_point | ( | enum raw_bkpt_type | type,
|  | CORE_ADDR | addr,
|  | int | len,
|  | struct raw_breakpoint * | bp
| ) |  |
| static

Definition at line 460 of file linux-mips-low.c.

References process_info_private::arch_private, current_process(), current_thread, arch_process_info::current_watches, for_each_thread(), lwpid_of(), mips_add_watchpoint(), mips_linux_read_watch_registers(), mips_linux_watch_populate_regs(), mips_linux_watch_try_one_watch(), mips_linux_watch_type_to_irw(), process_info::pid, process_info::priv, raw_bkpt_type_to_target_hw_bp_type(), update_watch_registers_callback(), arch_process_info::watch_mirror, arch_process_info::watch_readback, and arch_process_info::watch_readback_valid.

## ◆ mips_linux_delete_process()

static void mips_linux_delete_process | ( | struct arch_process_info * | info | ) |
| static

Definition at line 324 of file linux-mips-low.c.

References xfree().

## ◆ mips_linux_delete_thread()

static void mips_linux_delete_thread | ( | struct arch_lwp_info * | arch_lwp | ) |
| static

Definition at line 346 of file linux-mips-low.c.

References xfree().

## ◆ mips_linux_new_fork()

static void mips_linux_new_fork | ( | struct process_info * | parent,
|  | struct process_info * | child
| ) |  |
| static

Definition at line 375 of file linux-mips-low.c.

References mips_watchpoint::addr, process_info_private::arch_private, arch_process_info::current_watches, gdb_assert, mips_watchpoint::len, mips_add_watchpoint(), mips_watchpoint::next, process_info::priv, mips_watchpoint::type, arch_process_info::watch_mirror, arch_process_info::watch_readback, and arch_process_info::watch_readback_valid.

## ◆ mips_linux_new_process()

static struct arch_process_info* mips_linux_new_process | ( | void |  | ) |
| static

Definition at line 313 of file linux-mips-low.c.

References XCNEW.

## ◆ mips_linux_new_thread()

static void mips_linux_new_thread | ( | struct lwp_info * | lwp | ) |
| static

Definition at line 334 of file linux-mips-low.c.

References lwp_info::arch_private, arch_lwp_info::watch_registers_changed, and XCNEW.

## ◆ mips_linux_prepare_to_resume()

static void mips_linux_prepare_to_resume | ( | struct lwp_info * | lwp | ) |
| static

Definition at line 418 of file linux-mips-low.c.

References process_info_private::arch_private, lwp_info::arch_private, find_process_pid(), get_lwp_thread, mips_linux_watch_get_num_valid(), perror_with_name(), process_info::priv, ptid_get_lwp(), ptid_get_pid(), ptid_of(), ptrace(), PTRACE_SET_WATCH_REGS, arch_process_info::watch_mirror, and arch_lwp_info::watch_registers_changed.

## ◆ mips_read_description()

static const struct target_desc* mips_read_description | ( | void |  | ) |
| static

Definition at line 125 of file linux-mips-low.c.

References current_thread, DSP_CONTROL, errno, have_dsp, lwpid_of(), perror_with_name(), ptrace(), tdesc_mips_dsp_linux, and tdesc_mips_linux.

Referenced by mips_arch_setup().

## ◆ mips_regs_info()

static const struct regs_info* mips_regs_info | ( | void |  | ) |
| static

Definition at line 869 of file linux-mips-low.c.

References dsp_regs_info, have_dsp, and regs_info.

## ◆ mips_remove_point()

static int mips_remove_point | ( | enum raw_bkpt_type | type,
|  | CORE_ADDR | addr,
|  | int | len,
|  | struct raw_breakpoint * | bp
| ) |  |
| static

Definition at line 505 of file linux-mips-low.c.

References mips_watchpoint::addr, process_info_private::arch_private, current_process(), arch_process_info::current_watches, for_each_thread(), free(), gdb_assert, mips_watchpoint::len, mips_linux_watch_populate_regs(), mips_watchpoint::next, process_info::pid, process_info::priv, raw_bkpt_type_to_target_hw_bp_type(), mips_watchpoint::type, update_watch_registers_callback(), arch_process_info::watch_mirror, arch_process_info::watch_readback, and arch_process_info::watch_readback_valid.

## ◆ mips_set_pc()

static void mips_set_pc | ( | struct regcache * | regcache,
|  | CORE_ADDR | pc
| ) |  |
| static

Definition at line 254 of file linux-mips-low.c.

References mips_register::buf, mips_register::reg32, mips_register::reg64, register_size(), supply_register_by_name(), and regcache::tdesc.

## ◆ mips_stopped_by_watchpoint()

static int mips_stopped_by_watchpoint | ( | void |  | ) |
| static

Definition at line 555 of file linux-mips-low.c.

References process_info_private::arch_private, current_process(), current_thread, lwpid_of(), MAX_DEBUG_REGISTER, mips_linux_read_watch_registers(), mips_linux_watch_get_num_valid(), mips_linux_watch_get_watchhi(), num_valid, process_info::priv, R_MASK, W_MASK, arch_process_info::watch_readback, and arch_process_info::watch_readback_valid.

## ◆ mips_stopped_data_address()

static CORE_ADDR mips_stopped_data_address | ( | void |  | ) |
| static

Definition at line 583 of file linux-mips-low.c.

References mips_watchpoint::addr, process_info_private::arch_private, current_process(), current_thread, arch_process_info::current_watches, IRW_MASK, mips_watchpoint::len, lwpid_of(), MAX_DEBUG_REGISTER, mips_linux_read_watch_registers(), mips_linux_watch_get_num_valid(), mips_linux_watch_get_watchhi(), mips_linux_watch_get_watchlo(), mips_linux_watch_type_to_irw(), mips_watchpoint::next, num_valid, process_info::priv, R_MASK, mips_watchpoint::type, W_MASK, arch_process_info::watch_readback, and arch_process_info::watch_readback_valid.

## ◆ mips_supports_z_point_type()

static int mips_supports_z_point_type | ( | char | z_type | ) |
| static

Definition at line 443 of file linux-mips-low.c.

References Z_PACKET_ACCESS_WP, Z_PACKET_READ_WP, and Z_PACKET_WRITE_WP.

## ◆ mips_sw_breakpoint_from_kind()

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

Definition at line 272 of file linux-mips-low.c.

References mips_breakpoint, and mips_breakpoint_len.

## ◆ ps_get_thread_area()

ps_err_e ps_get_thread_area | ( | struct ps_prochandle * | ph,
|  | lwpid_t | lwpid,
|  | int | idx,
|  | void ** | base
| ) |  |

Definition at line 644 of file linux-mips-low.c.

References PS_ERR, PS_OK, ptrace(), and PTRACE_GET_THREAD_AREA.

## ◆ update_watch_registers_callback()

static void update_watch_registers_callback | ( | thread_info * | thread | ) |
| static

Definition at line 295 of file linux-mips-low.c.

References lwp_info::arch_private, get_thread_lwp, linux_stop_lwp(), lwp_info::stopped, lwp_info::thread, and arch_lwp_info::watch_registers_changed.

Referenced by mips_insert_point(), and mips_remove_point().

## Variable Documentation

## ◆ dsp_regs_info

struct regs_info dsp_regs_info
| static

Initial value:
=
{
mips_dsp_regset_bitmap,
&mips_dsp_usrregs_info,
&mips_regsets_info
}
mips_regsets_info
static struct regsets_info mips_regsets_info
Definition: linux-mips-low.c:835
mips_dsp_usrregs_info
static struct usrregs_info mips_dsp_usrregs_info
Definition: linux-mips-low.c:842
mips_dsp_regset_bitmap
static unsigned char mips_dsp_regset_bitmap[(mips_dsp_num_regs+7)/8]
Definition: linux-mips-low.c:115

Definition at line 854 of file linux-mips-low.c.

Referenced by mips_regs_info().

## ◆ have_dsp

int have_dsp = -1
| static

Definition at line 119 of file linux-mips-low.c.

Referenced by mips_read_description(), and mips_regs_info().

## ◆ mips_breakpoint

const unsigned int mips_breakpoint = 0x0005000d
| static

Definition at line 266 of file linux-mips-low.c.

Referenced by mips_breakpoint_at(), and mips_sw_breakpoint_from_kind().

## ◆ mips_dsp_regmap

int mips_dsp_regmap[mips_dsp_num_regs]
| static

Initial value:
= {
mips_base_regs,
mips_dsp_regs,
0
}
mips_base_regs
#define mips_base_regs
Definition: linux-mips-low.c:78
mips_dsp_regs
#define mips_dsp_regs
Definition: linux-mips-low.c:96

Definition at line 106 of file linux-mips-low.c.

## ◆ mips_dsp_regset_bitmap

unsigned char mips_dsp_regset_bitmap[(mips_dsp_num_regs+7)/8]
| static

Initial value:
= {
0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x80
}

Definition at line 115 of file linux-mips-low.c.

## ◆ mips_dsp_usrregs_info

struct usrregs_info mips_dsp_usrregs_info
| static

Initial value:
=
{
mips_dsp_num_regs,
mips_dsp_regmap,
}
mips_dsp_num_regs
#define mips_dsp_num_regs
Definition: linux-mips-low.c:58
mips_dsp_regmap
static int mips_dsp_regmap[mips_dsp_num_regs]
Definition: linux-mips-low.c:106

Definition at line 842 of file linux-mips-low.c.

## ◆ mips_regmap

int mips_regmap[mips_num_regs]
| static

Initial value:
= {
mips_base_regs,
0
}
mips_base_regs
#define mips_base_regs
Definition: linux-mips-low.c:78

Definition at line 101 of file linux-mips-low.c.

## ◆ mips_regsets

struct regset_info mips_regsets[]
| static

Initial value:
= {
NULL_REGSET
}

Definition at line 825 of file linux-mips-low.c.

## ◆ mips_regsets_info

struct regsets_info mips_regsets_info
| static

Initial value:
=
{
mips_regsets,
0,
NULL,
}
mips_regsets
static struct regset_info mips_regsets[]
Definition: linux-mips-low.c:825

Definition at line 835 of file linux-mips-low.c.

Referenced by initialize_low_arch().

## ◆ mips_usrregs_info

struct usrregs_info mips_usrregs_info
| static

Initial value:
=
{
mips_num_regs,
mips_regmap,
}
mips_num_regs
#define mips_num_regs
Definition: linux-mips-low.c:57
mips_regmap
static int mips_regmap[mips_num_regs]
Definition: linux-mips-low.c:101

Definition at line 848 of file linux-mips-low.c.

## ◆ regs_info

struct regs_info regs_info
| static

Initial value:
=
{
NULL,
&mips_usrregs_info,
&mips_regsets_info
}
mips_regsets_info
static struct regsets_info mips_regsets_info
Definition: linux-mips-low.c:835
mips_usrregs_info
static struct usrregs_info mips_usrregs_info
Definition: linux-mips-low.c:848

Definition at line 861 of file linux-mips-low.c.

Referenced by mips_regs_info().

## ◆ tdesc_mips64_dsp_linux

const struct target_desc* tdesc_mips64_dsp_linux

## ◆ tdesc_mips64_linux

const struct target_desc* tdesc_mips64_linux

## ◆ tdesc_mips_dsp_linux

const struct target_desc* tdesc_mips_dsp_linux

Referenced by mips_read_description().

## ◆ tdesc_mips_linux

const struct target_desc* tdesc_mips_linux

Referenced by mips_read_description().

## ◆ the_low_target

struct linux_target_ops the_low_target

Initial value:
= {
mips_arch_setup,
mips_regs_info,
mips_cannot_fetch_register,
mips_cannot_store_register,
NULL,
mips_get_pc,
mips_set_pc,
NULL,
mips_sw_breakpoint_from_kind,
NULL,
0,
mips_breakpoint_at,
mips_supports_z_point_type,
mips_insert_point,
mips_remove_point,
mips_stopped_by_watchpoint,
mips_stopped_data_address,
NULL,
NULL,
NULL,
mips_linux_new_process,
mips_linux_delete_process,
mips_linux_new_thread,
mips_linux_delete_thread,
mips_linux_new_fork,
mips_linux_prepare_to_resume
}
mips_linux_new_thread
static void mips_linux_new_thread(struct lwp_info *lwp)
Definition: linux-mips-low.c:334
mips_cannot_fetch_register
static int mips_cannot_fetch_register(int regno)
Definition: linux-mips-low.c:205
mips_linux_prepare_to_resume
static void mips_linux_prepare_to_resume(struct lwp_info *lwp)
Definition: linux-mips-low.c:418
mips_linux_delete_process
static void mips_linux_delete_process(struct arch_process_info *info)
Definition: linux-mips-low.c:324
mips_regs_info
static const struct regs_info * mips_regs_info(void)
Definition: linux-mips-low.c:869
mips_linux_new_process
static struct arch_process_info * mips_linux_new_process(void)
Definition: linux-mips-low.c:313
mips_supports_z_point_type
static int mips_supports_z_point_type(char z_type)
Definition: linux-mips-low.c:443
mips_linux_delete_thread
static void mips_linux_delete_thread(struct arch_lwp_info *arch_lwp)
Definition: linux-mips-low.c:346
mips_arch_setup
static void mips_arch_setup(void)
Definition: linux-mips-low.c:151
mips_insert_point
static int mips_insert_point(enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
Definition: linux-mips-low.c:460
mips_cannot_store_register
static int mips_cannot_store_register(int regno)
Definition: linux-mips-low.c:221
mips_remove_point
static int mips_remove_point(enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
Definition: linux-mips-low.c:505
mips_breakpoint_at
static int mips_breakpoint_at(CORE_ADDR where)
Definition: linux-mips-low.c:279
mips_linux_new_fork
static void mips_linux_new_fork(struct process_info *parent, struct process_info *child)
Definition: linux-mips-low.c:375
mips_stopped_by_watchpoint
static int mips_stopped_by_watchpoint(void)
Definition: linux-mips-low.c:555
mips_sw_breakpoint_from_kind
static const gdb_byte * mips_sw_breakpoint_from_kind(int kind, int *size)
Definition: linux-mips-low.c:272
mips_stopped_data_address
static CORE_ADDR mips_stopped_data_address(void)
Definition: linux-mips-low.c:583
mips_set_pc
static void mips_set_pc(struct regcache *regcache, CORE_ADDR pc)
Definition: linux-mips-low.c:254
mips_get_pc
static CORE_ADDR mips_get_pc(struct regcache *regcache)
Definition: linux-mips-low.c:246

Definition at line 877 of file linux-mips-low.c.

Referenced by get_usrregs_info().