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

Go to the source code of this file.

Data Structures

struct  cpu_context
 
struct  current_thread
 
struct  linux_os
 
struct  threads
 

Macros

#define INIT_TASK   0
 
#define LINUX_USER_KERNEL_BORDER   0xc0000000
 
#define MAX_THREADS   200
 
#define PHYS
 

Functions

static struct current_threadadd_current_thread (struct current_thread *currents, struct current_thread *ct)
 
static int clean_threadlist (struct target *target)
 
static struct cpu_contextcpu_context_read (struct target *target, uint32_t base_addr, uint32_t *info_addr)
 
static int current_base_addr (struct linux_os *linux_os, uint32_t base_addr)
 
static int fill_buffer (struct target *target, uint32_t addr, uint8_t *buffer)
 
static int fill_task (struct target *target, struct threads *t)
 
static uint32_t get_buffer (struct target *target, const uint8_t *buffer)
 
static int get_current (struct target *target, int create)
 
static int get_name (struct target *target, struct threads *t)
 
static int insert_into_threadlist (struct target *target, struct threads *t)
 
static int linux_compute_virt2phys (struct target *target, target_addr_t address)
 
static int linux_gdb_h_packet (struct connection *connection, struct target *target, char const *packet, int packet_size)
 
static int linux_gdb_t_packet (struct connection *connection, struct target *target, char const *packet, int packet_size)
 
static int linux_gdb_thread_packet (struct target *target, struct connection *connection, char const *packet, int packet_size)
 
static int linux_gdb_thread_update (struct target *target, struct connection *connection, char const *packet, int packet_size)
 
static int linux_get_symbol_list_to_lookup (struct symbol_table_elem *symbol_list[])
 
static int linux_get_tasks (struct target *target, int context)
 
static void linux_identify_current_threads (struct target *target)
 
static int linux_os_clean (struct target *target)
 
static int linux_os_create (struct target *target)
 
static bool linux_os_detect (struct target *target)
 
static int linux_os_dummy_update (struct rtos *rtos)
 
static int linux_os_smp_init (struct target *target)
 
static int linux_os_thread_reg_list (struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
 
static char * linux_ps_command (struct target *target)
 
static int linux_read_memory (struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 
static int linux_task_update (struct target *target, int context)
 
static int linux_thread_extra_info (struct target *target, struct connection *connection, char const *packet, int packet_size)
 
static int linux_thread_packet (struct connection *connection, char const *packet, int packet_size)
 
static struct threadsliste_add_task (struct threads *task_list, struct threads *t, struct threads **last)
 
static struct threadsliste_del_task (struct threads *task_list, struct threads **t, struct threads *prev)
 
static uint32_t next_task (struct target *target, struct threads *t)
 

Variables

const struct rtos_type linux_rtos
 
static const char *const linux_symbol_list []
 

Macro Definition Documentation

◆ INIT_TASK

#define INIT_TASK   0

Definition at line 230 of file linux.c.

◆ LINUX_USER_KERNEL_BORDER

#define LINUX_USER_KERNEL_BORDER   0xc0000000

Definition at line 25 of file linux.c.

◆ MAX_THREADS

#define MAX_THREADS   200

Definition at line 28 of file linux.c.

◆ PHYS

#define PHYS

Definition at line 27 of file linux.c.

Function Documentation

◆ add_current_thread()

static struct current_thread* add_current_thread ( struct current_thread currents,
struct current_thread ct 
)
static

Definition at line 586 of file linux.c.

References current_thread::next, and NULL.

Referenced by linux_os_create(), and linux_os_smp_init().

◆ clean_threadlist()

static int clean_threadlist ( struct target target)
static

Definition at line 759 of file linux.c.

References ERROR_OK, target::rtos, rtos::rtos_specific_params, and linux_os::thread_list.

Referenced by linux_os_clean().

◆ cpu_context_read()

◆ current_base_addr()

static int current_base_addr ( struct linux_os linux_os,
uint32_t  base_addr 
)
static

Definition at line 650 of file linux.c.

References linux_os::current_threads, current_thread::next, and current_thread::TS.

Referenced by linux_get_tasks().

◆ fill_buffer()

static int fill_buffer ( struct target target,
uint32_t  addr,
uint8_t *  buffer 
)
static

Definition at line 137 of file linux.c.

References addr, buffer, linux_read_memory(), and LOG_INFO.

Referenced by cpu_context_read(), fill_task(), get_current(), and next_task().

◆ fill_task()

static int fill_task ( struct target target,
struct threads t 
)
static

◆ get_buffer()

static uint32_t get_buffer ( struct target target,
const uint8_t *  buffer 
)
static

Definition at line 148 of file linux.c.

References buffer, and target_buffer_get_u32().

Referenced by cpu_context_read(), fill_task(), get_current(), and next_task().

◆ get_current()

◆ get_name()

static int get_name ( struct target target,
struct threads t 
)
static

◆ insert_into_threadlist()

static int insert_into_threadlist ( struct target target,
struct threads t 
)
static

◆ linux_compute_virt2phys()

static int linux_compute_virt2phys ( struct target target,
target_addr_t  address 
)
static

◆ linux_gdb_h_packet()

static int linux_gdb_h_packet ( struct connection connection,
struct target target,
char const *  packet,
int  packet_size 
)
static

◆ linux_gdb_t_packet()

static int linux_gdb_t_packet ( struct connection connection,
struct target target,
char const *  packet,
int  packet_size 
)
static

◆ linux_gdb_thread_packet()

static int linux_gdb_thread_packet ( struct target target,
struct connection connection,
char const *  packet,
int  packet_size 
)
static

◆ linux_gdb_thread_update()

static int linux_gdb_thread_update ( struct target target,
struct connection connection,
char const *  packet,
int  packet_size 
)
static

◆ linux_get_symbol_list_to_lookup()

static int linux_get_symbol_list_to_lookup ( struct symbol_table_elem symbol_list[])
static

Definition at line 236 of file linux.c.

References ARRAY_SIZE, linux_symbol_list, and symbol_table_elem::symbol_name.

◆ linux_get_tasks()

◆ linux_identify_current_threads()

◆ linux_os_clean()

◆ linux_os_create()

◆ linux_os_detect()

static bool linux_os_detect ( struct target target)
static

Definition at line 222 of file linux.c.

References LOG_INFO.

◆ linux_os_dummy_update()

static int linux_os_dummy_update ( struct rtos rtos)
static

Definition at line 91 of file linux.c.

◆ linux_os_smp_init()

◆ linux_os_thread_reg_list()

static int linux_os_thread_reg_list ( struct rtos rtos,
int64_t  thread_id,
struct rtos_reg **  reg_list,
int *  num_regs 
)
static

◆ linux_ps_command()

◆ linux_read_memory()

static int linux_read_memory ( struct target target,
uint32_t  address,
uint32_t  size,
uint32_t  count,
uint8_t *  buffer 
)
static

◆ linux_task_update()

◆ linux_thread_extra_info()

static int linux_thread_extra_info ( struct target target,
struct connection connection,
char const *  packet,
int  packet_size 
)
static

◆ linux_thread_packet()

◆ liste_add_task()

static struct threads* liste_add_task ( struct threads task_list,
struct threads t,
struct threads **  last 
)
static

Definition at line 622 of file linux.c.

References threads::next, and NULL.

Referenced by linux_get_tasks().

◆ liste_del_task()

static struct threads* liste_del_task ( struct threads task_list,
struct threads **  t,
struct threads prev 
)
static

Definition at line 605 of file linux.c.

References LOG_INFO, and threads::next.

Referenced by linux_gdb_t_packet().

◆ next_task()

static uint32_t next_task ( struct target target,
struct threads t 
)
static

Definition at line 567 of file linux.c.

References threads::base_addr, buffer, ERROR_OK, fill_buffer(), get_buffer(), LOG_ERROR, and NEXT.

Referenced by linux_get_tasks(), and linux_task_update().

Variable Documentation

◆ linux_rtos

const struct rtos_type linux_rtos
Initial value:
= {
.name = "linux",
.detect_rtos = linux_os_detect,
.create = linux_os_create,
.smp_init = linux_os_smp_init,
.update_threads = linux_os_dummy_update,
.get_thread_reg_list = linux_os_thread_reg_list,
.get_symbol_list_to_lookup = linux_get_symbol_list_to_lookup,
.clean = linux_os_clean,
.ps_command = linux_ps_command,
}
static int linux_os_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
Definition: linux.c:156
static char * linux_ps_command(struct target *target)
Definition: linux.c:1435
static int linux_os_smp_init(struct target *target)
Definition: linux.c:1375
static int linux_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
Definition: linux.c:236
static int linux_os_clean(struct target *target)
Definition: linux.c:777
static bool linux_os_detect(struct target *target)
Definition: linux.c:222
static int linux_os_dummy_update(struct rtos *rtos)
Definition: linux.c:91
static int linux_os_create(struct target *target)
Definition: linux.c:1406

Definition at line 248 of file linux.c.

◆ linux_symbol_list

const char* const linux_symbol_list[]
static
Initial value:
= {
"init_task",
}
#define NULL
Definition: usb.h:16

Definition at line 231 of file linux.c.

Referenced by linux_get_symbol_list_to_lookup().