OpenOCD
semihosting Struct Reference
Collaboration diagram for semihosting:

Data Fields

char * basedir
 Base directory for semihosting I/O operations. More...
 
char * cmdline
 The semihosting command line to be passed to the target. More...
 
bool has_resumable_exit
 When SEMIHOSTING_SYS_EXIT is called outside a debug session, things are simple, the openocd process calls exit() and passes the value returned by the target. More...
 
bool hit_fileio
 A flag reporting whether semihosting fileio operation is active. More...
 
bool is_active
 A flag reporting whether semihosting is active. More...
 
bool is_fileio
 A flag reporting whether semihosting fileio is active. More...
 
bool is_resumable
 Most are resumable, except the two exit calls. More...
 
int op
 The current semihosting operation (R0 on ARM). More...
 
uint64_t param
 The current semihosting parameter (R1 or ARM). More...
 
int(* post_result )(struct target *target)
 
enum semihosting_redirect_config redirect_cfg
 redirection configuration, NONE by default More...
 
int64_t result
 The current semihosting result to be returned to the application. More...
 
int(* setup )(struct target *target, int enable)
 
clock_t setup_time
 The current time when 'execution starts'. More...
 
int stderr_fd
 
int stdin_fd
 Semihosting STDIO file descriptors. More...
 
int stdout_fd
 
int sys_errno
 The value to be returned by semihosting SYS_ERRNO request. More...
 
struct connectiontcp_connection
 Handle to redirect semihosting print via tcp. More...
 
int(* user_command_extension )(struct target *target)
 Target's extension of semihosting user commands. More...
 
size_t word_size_bytes
 The Target (hart) word size; 8 for 64-bits targets. More...
 

Detailed Description

Definition at line 107 of file semihosting_common.h.

Field Documentation

◆ basedir

char* semihosting::basedir

Base directory for semihosting I/O operations.

Definition at line 176 of file semihosting_common.h.

Referenced by COMMAND_HANDLER(), esp_semihosting_basedir_command(), esp_xtensa_semihosting(), semihosting_common(), semihosting_common_init(), and target_destroy().

◆ cmdline

char* semihosting::cmdline

The semihosting command line to be passed to the target.

Definition at line 170 of file semihosting_common.h.

Referenced by COMMAND_HANDLER(), gdb_handle_vrun_packet(), semihosting_common(), and semihosting_common_init().

◆ has_resumable_exit

bool semihosting::has_resumable_exit

When SEMIHOSTING_SYS_EXIT is called outside a debug session, things are simple, the openocd process calls exit() and passes the value returned by the target.

When SEMIHOSTING_SYS_EXIT is called during a debug session, by default execution returns to the debugger, leaving the debugger in a HALT state, similar to the state entered when encountering a break. In some use cases, it is useful to have SEMIHOSTING_SYS_EXIT return normally, as any semihosting call, and do not break to the debugger. The standard allows this to happen, but the condition to trigger it is a bit obscure ("by performing an RDI_Execute request or equivalent").

To make the SEMIHOSTING_SYS_EXIT call return normally, enable this variable via the dedicated command (default: disabled).

Definition at line 148 of file semihosting_common.h.

Referenced by COMMAND_HANDLER(), semihosting_common(), and semihosting_common_init().

◆ hit_fileio

bool semihosting::hit_fileio

◆ is_active

bool semihosting::is_active

◆ is_fileio

bool semihosting::is_fileio

A flag reporting whether semihosting fileio is active.

Definition at line 122 of file semihosting_common.h.

Referenced by arm_arch_state(), armv7m_arch_state(), COMMAND_HANDLER(), semihosting_common(), semihosting_common_fileio_info(), and semihosting_common_init().

◆ is_resumable

bool semihosting::is_resumable

Most are resumable, except the two exit calls.

Definition at line 128 of file semihosting_common.h.

Referenced by arm_semihosting(), esp_xtensa_semihosting(), semihosting_common(), and semihosting_common_init().

◆ op

int semihosting::op

◆ param

uint64_t semihosting::param

◆ post_result

int(* semihosting::post_result) (struct target *target)

◆ redirect_cfg

enum semihosting_redirect_config semihosting::redirect_cfg

redirection configuration, NONE by default

Definition at line 113 of file semihosting_common.h.

Referenced by COMMAND_HANDLER(), semihosting_common_init(), and semihosting_is_redirected().

◆ result

int64_t semihosting::result

The current semihosting result to be returned to the application.

Usually 0 for success, -1 for error, but sometimes a useful value, even a pointer.

Definition at line 164 of file semihosting_common.h.

Referenced by esp_semihosting_common(), esp_semihosting_sys_seek(), esp_xtensa_semihosting_post_result(), post_result(), riscv_semihosting_post_result(), semihosting_common(), semihosting_common_fileio_end(), and semihosting_common_init().

◆ setup

int(* semihosting::setup) (struct target *target, int enable)

◆ setup_time

clock_t semihosting::setup_time

The current time when 'execution starts'.

Definition at line 173 of file semihosting_common.h.

Referenced by riscv_semihosting_setup(), semihosting_common(), and semihosting_common_init().

◆ stderr_fd

int semihosting::stderr_fd

◆ stdin_fd

int semihosting::stdin_fd

Semihosting STDIO file descriptors.

Definition at line 113 of file semihosting_common.h.

Referenced by semihosting_common(), semihosting_common_init(), and semihosting_is_redirected().

◆ stdout_fd

int semihosting::stdout_fd

◆ sys_errno

◆ tcp_connection

struct connection* semihosting::tcp_connection

Handle to redirect semihosting print via tcp.

Definition at line 119 of file semihosting_common.h.

Referenced by semihosting_common_init(), semihosting_redirect_read(), and semihosting_redirect_write().

◆ user_command_extension

int(* semihosting::user_command_extension) (struct target *target)

Target's extension of semihosting user commands.

Returns
ERROR_NOT_IMPLEMENTED when user command is not handled, otherwise sets semihosting->result and semihosting->sys_errno and returns ERROR_OK.

Definition at line 183 of file semihosting_common.h.

Referenced by esp_xtensa_semihosting_init(), semihosting_common(), and semihosting_common_init().

◆ word_size_bytes

size_t semihosting::word_size_bytes

The documentation for this struct was generated from the following file: