1 /***************************************************************************
2 * Copyright (C) 2011 by Broadcom Corporation *
3 * Evan Hunter - ehunter@broadcom.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
22 #include "server/server.h"
25 typedef int64_t threadid_t
;
26 typedef int64_t symbol_address_t
;
31 * Table should be terminated by an element with NULL in symbol_name
33 typedef struct symbol_table_elem_struct
{
34 const char *symbol_name
;
35 symbol_address_t address
;
37 } symbol_table_elem_t
;
39 struct thread_detail
{
43 char *thread_name_str
;
48 const struct rtos_type
*type
;
50 symbol_table_elem_t
*symbols
;
51 struct target
*target
;
52 /* add a context variable instead of global variable */
53 int64_t current_threadid
;
54 threadid_t current_thread
;
55 struct thread_detail
*thread_details
;
57 int (*gdb_thread_packet
)(struct connection
*connection
, char const *packet
, int packet_size
);
58 void *rtos_specific_params
;
63 int (*detect_rtos
)(struct target
*target
);
64 int (*create
)(struct target
*target
);
65 int (*smp_init
)(struct target
*target
);
66 int (*update_threads
)(struct rtos
*rtos
);
67 int (*get_thread_reg_list
)(struct rtos
*rtos
, int64_t thread_id
, char **hex_reg_list
);
68 int (*get_symbol_list_to_lookup
)(symbol_table_elem_t
*symbol_list
[]);
69 int (*clean
)(struct target
*target
);
70 char * (*ps_command
)(struct target
*target
);
73 struct stack_register_offset
{
74 signed short offset
; /* offset in bytes from stack head, or -1 to indicate
75 * register is not stacked, or -2 to indicate this is the
76 * stack pointer register */
77 unsigned short width_bits
;
80 struct rtos_register_stacking
{
81 unsigned char stack_registers_size
;
82 signed char stack_growth_direction
;
83 unsigned char num_output_registers
;
84 /* Some targets require evaluating the stack to determine the
85 * actual stack pointer for a process. If this field is NULL,
86 * just use stacking->stack_registers_size * stack_growth_direction
87 * to calculate adjustment.
89 int64_t (*calculate_process_stack
)(struct target
*target
,
90 const uint8_t *stack_data
,
91 const struct rtos_register_stacking
*stacking
,
93 const struct stack_register_offset
*register_offsets
;
96 #define GDB_THREAD_PACKET_NOT_CONSUMED (-40)
98 int rtos_create(Jim_GetOptInfo
*goi
, struct target
*target
);
99 int rtos_generic_stack_read(struct target
*target
,
100 const struct rtos_register_stacking
*stacking
,
102 char **hex_reg_list
);
103 int rtos_try_next(struct target
*target
);
104 int gdb_thread_packet(struct connection
*connection
, char const *packet
, int packet_size
);
105 int rtos_get_gdb_reg_list(struct connection
*connection
);
106 int rtos_update_threads(struct target
*target
);
107 void rtos_free_threadlist(struct rtos
*rtos
);
108 int rtos_smp_init(struct target
*target
);
109 /* function for handling symbol access */
110 int rtos_qsymbol(struct connection
*connection
, char const *packet
, int packet_size
);