OpenOCD
rtos.c File Reference
Include dependency graph for rtos.c:

Go to the source code of this file.

Functions

static struct symbol_table_elemfind_symbol (const struct rtos *os, const char *symbol)
 
int gdb_thread_packet (struct connection *connection, char const *packet, int packet_size)
 
static struct symbol_table_elemnext_symbol (struct rtos *os, char *cur_symbol, uint64_t cur_addr)
 
static int os_alloc (struct target *target, const struct rtos_type *ostype)
 
static int os_alloc_create (struct target *target, const struct rtos_type *ostype)
 
static void os_free (struct target *target)
 
int rtos_create (struct command_invocation *cmd, struct target *target, const char *rtos_name)
 
void rtos_destroy (struct target *target)
 
void rtos_free_threadlist (struct rtos *rtos)
 
struct rtosrtos_from_target (struct target *target)
 Get the RTOS from the target itself, or from one of the targets in the same SMP node, or NULL when no RTOS is set. More...
 
int rtos_generic_stack_read (struct target *target, const struct rtos_register_stacking *stacking, int64_t stack_ptr, struct rtos_reg **reg_list, int *num_regs)
 
int rtos_get_gdb_reg (struct connection *connection, int reg_num)
 Look through all registers to find this register. More...
 
int rtos_get_gdb_reg_list (struct connection *connection)
 Return a list of general registers. More...
 
bool rtos_needs_fake_step (struct target *target, int64_t thread_id)
 
static int rtos_put_gdb_reg (struct connection *connection, uint8_t *reg_value, unsigned int reg_size)
 
static int rtos_put_gdb_reg_list (struct connection *connection, struct rtos_reg *reg_list, int num_regs)
 
int rtos_qsymbol (struct connection *connection, char const *packet, int packet_size)
 
int rtos_read_buffer (struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
 
int rtos_set_reg (struct connection *connection, int reg_num, uint8_t *reg_value)
 
int rtos_smp_init (struct target *target)
 
struct targetrtos_swbp_target (struct target *target, target_addr_t address, uint32_t length, enum breakpoint_type type)
 
static int rtos_target_for_threadid (struct connection *connection, int64_t threadid, struct target **t)
 
int rtos_thread_packet (struct connection *connection, char const *packet, int packet_size)
 
static bool rtos_try_next (struct target *target)
 
int rtos_update_threads (struct target *target)
 
int rtos_write_buffer (struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
 

Variables

static const struct rtos_typertos_types []
 

Function Documentation

◆ find_symbol()

static struct symbol_table_elem* find_symbol ( const struct rtos os,
const char *  symbol 
)
static

Definition at line 182 of file rtos.c.

References NULL, symbol_table_elem::symbol_name, and rtos::symbols.

Referenced by next_symbol(), and rtos_qsymbol().

◆ gdb_thread_packet()

int gdb_thread_packet ( struct connection connection,
char const *  packet,
int  packet_size 
)

◆ next_symbol()

static struct symbol_table_elem* next_symbol ( struct rtos os,
char *  cur_symbol,
uint64_t  cur_addr 
)
static

◆ os_alloc()

◆ os_alloc_create()

static int os_alloc_create ( struct target target,
const struct rtos_type ostype 
)
static

Definition at line 87 of file rtos.c.

References rtos_type::create, ERROR_OK, os_alloc(), os_free(), target::rtos, and rtos::type.

Referenced by rtos_create().

◆ os_free()

static void os_free ( struct target target)
static

Definition at line 76 of file rtos.c.

References NULL, target::rtos, rtos_free_threadlist(), and rtos::symbols.

Referenced by os_alloc_create(), rtos_create(), and rtos_destroy().

◆ rtos_create()

int rtos_create ( struct command_invocation cmd,
struct target target,
const char *  rtos_name 
)

◆ rtos_destroy()

void rtos_destroy ( struct target target)

Definition at line 145 of file rtos.c.

References os_free().

Referenced by COMMAND_HANDLER(), and target_destroy().

◆ rtos_free_threadlist()

◆ rtos_from_target()

struct rtos* rtos_from_target ( struct target target)

Get the RTOS from the target itself, or from one of the targets in the same SMP node, or NULL when no RTOS is set.

Definition at line 719 of file rtos.c.

References foreach_smp_target, NULL, target::rtos, target::smp_targets, target_list::target, and rtos::type.

Referenced by gdb_signal_reply(), and rtos_update_threads().

◆ rtos_generic_stack_read()

◆ rtos_get_gdb_reg()

int rtos_get_gdb_reg ( struct connection connection,
int  reg_num 
)

◆ rtos_get_gdb_reg_list()

int rtos_get_gdb_reg_list ( struct connection connection)

◆ rtos_needs_fake_step()

bool rtos_needs_fake_step ( struct target target,
int64_t  thread_id 
)

Definition at line 774 of file rtos.c.

References rtos::current_thread, rtos_type::needs_fake_step, target::rtos, and rtos::type.

Referenced by gdb_handle_vcont_packet().

◆ rtos_put_gdb_reg()

static int rtos_put_gdb_reg ( struct connection connection,
uint8_t *  reg_value,
unsigned int  reg_size 
)
static

Definition at line 507 of file rtos.c.

References DIV_ROUND_UP, ERROR_FAIL, ERROR_OK, gdb_put_packet(), hexify(), and LOG_ERROR.

Referenced by rtos_get_gdb_reg().

◆ rtos_put_gdb_reg_list()

static int rtos_put_gdb_reg_list ( struct connection connection,
struct rtos_reg reg_list,
int  num_regs 
)
static

Definition at line 527 of file rtos.c.

References count, DIV_ROUND_UP, ERROR_OK, gdb_put_packet(), hexify(), and size.

Referenced by rtos_get_gdb_reg(), and rtos_get_gdb_reg_list().

◆ rtos_qsymbol()

◆ rtos_read_buffer()

int rtos_read_buffer ( struct target target,
target_addr_t  address,
uint32_t  size,
uint8_t *  buffer 
)

◆ rtos_set_reg()

int rtos_set_reg ( struct connection connection,
int  reg_num,
uint8_t *  reg_value 
)

◆ rtos_smp_init()

int rtos_smp_init ( struct target target)

Definition at line 40 of file rtos.c.

References ERROR_TARGET_INIT_FAILED, target::rtos, rtos_type::smp_init, and rtos::type.

Referenced by COMMAND_HANDLER().

◆ rtos_swbp_target()

struct target* rtos_swbp_target ( struct target target,
target_addr_t  address,
uint32_t  length,
enum breakpoint_type  type 
)

Definition at line 781 of file rtos.c.

References address, length, target::rtos, rtos_type::swbp_target, target, type, and rtos::type.

Referenced by gdb_breakpoint_watchpoint_packet().

◆ rtos_target_for_threadid()

static int rtos_target_for_threadid ( struct connection connection,
int64_t  threadid,
struct target **  t 
)
static

Definition at line 47 of file rtos.c.

References ERROR_OK, and get_target_from_connection().

Referenced by os_alloc().

◆ rtos_thread_packet()

◆ rtos_try_next()

static bool rtos_try_next ( struct target target)
static

Definition at line 159 of file rtos.c.

References ARRAY_SIZE, NULL, target::rtos, rtos_types, rtos::symbols, and rtos::type.

Referenced by rtos_qsymbol().

◆ rtos_update_threads()

int rtos_update_threads ( struct target target)

◆ rtos_write_buffer()

int rtos_write_buffer ( struct target target,
target_addr_t  address,
uint32_t  size,
const uint8_t *  buffer 
)

Variable Documentation

◆ rtos_types

const struct rtos_type* rtos_types[]
static
Initial value:
= {
}
const struct rtos_type chibios_rtos
Definition: chibios.c:99
const struct rtos_type chromium_ec_rtos
Definition: chromium-ec.c:383
const struct rtos_type ecos_rtos
Definition: ecos.c:455
const struct rtos_type embkernel_rtos
Definition: embkernel.c:29
const struct rtos_type freertos_rtos
Definition: freertos.c:82
const struct rtos_type hwthread_rtos
Definition: hwthread.c:53
const struct rtos_type linux_rtos
Definition: linux.c:250
const struct rtos_type mqx_rtos
Definition: mqx.c:499
const struct rtos_type nuttx_rtos
Definition: nuttx.c:396
const struct rtos_type riot_rtos
Definition: riot.c:97
const struct rtos_type rtkernel_rtos
Definition: rtkernel.c:375
const struct rtos_type zephyr_rtos
Definition: zephyr.c:788
const struct rtos_type threadx_rtos
Definition: threadx.c:193
const struct rtos_type ucos_iii_rtos
Definition: ucos_iii.c:501

Definition at line 20 of file rtos.c.

Referenced by rtos_create(), and rtos_try_next().