2023-03-03 05:57:47 +03:00
|
|
|
/*
|
|
|
|
* gdbstub user-mode only APIs
|
|
|
|
*
|
|
|
|
* Copyright (c) 2022 Linaro Ltd
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: LGPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GDBSTUB_USER_H
|
|
|
|
#define GDBSTUB_USER_H
|
|
|
|
|
2024-03-09 06:08:59 +03:00
|
|
|
#define MAX_SIGINFO_LENGTH 128
|
|
|
|
|
2023-03-03 05:57:47 +03:00
|
|
|
/**
|
2024-03-09 06:08:57 +03:00
|
|
|
* gdb_handlesig() - yield control to gdb
|
2023-03-03 05:57:47 +03:00
|
|
|
* @cpu: CPU
|
|
|
|
* @sig: if non-zero, the signal number which caused us to stop
|
2024-02-07 19:38:09 +03:00
|
|
|
* @reason: stop reason for stop reply packet or NULL
|
2024-03-09 06:08:59 +03:00
|
|
|
* @siginfo: target-specific siginfo struct
|
|
|
|
* @siginfo_len: target-specific siginfo struct length
|
2023-03-03 05:57:47 +03:00
|
|
|
*
|
|
|
|
* This function yields control to gdb, when a user-mode-only target
|
|
|
|
* needs to stop execution. If @sig is non-zero, then we will send a
|
|
|
|
* stop packet to tell gdb that we have stopped because of this signal.
|
|
|
|
*
|
|
|
|
* This function will block (handling protocol requests from gdb)
|
|
|
|
* until gdb tells us to continue target execution. When it does
|
|
|
|
* return, the return value is a signal to deliver to the target,
|
|
|
|
* or 0 if no signal should be delivered, ie the signal that caused
|
|
|
|
* us to stop should be ignored.
|
|
|
|
*/
|
2024-03-09 06:08:59 +03:00
|
|
|
int gdb_handlesig(CPUState *, int, const char *, void *, int);
|
2023-03-03 05:57:47 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gdb_signalled() - inform remote gdb of sig exit
|
|
|
|
* @as: current CPUArchState
|
|
|
|
* @sig: signal number
|
|
|
|
*/
|
|
|
|
void gdb_signalled(CPUArchState *as, int sig);
|
|
|
|
|
2024-03-05 15:09:41 +03:00
|
|
|
/**
|
|
|
|
* gdbserver_fork_start() - inform gdb of the upcoming fork()
|
|
|
|
*/
|
|
|
|
void gdbserver_fork_start(void);
|
|
|
|
|
2023-03-03 05:57:47 +03:00
|
|
|
/**
|
2024-03-05 15:09:44 +03:00
|
|
|
* gdbserver_fork_end() - inform gdb of the completed fork()
|
2023-03-03 05:57:47 +03:00
|
|
|
* @cs: CPU
|
2024-03-05 15:09:44 +03:00
|
|
|
* @pid: 0 if in child process, -1 if fork failed, child process pid otherwise
|
2023-03-03 05:57:47 +03:00
|
|
|
*/
|
2024-03-05 15:09:44 +03:00
|
|
|
void gdbserver_fork_end(CPUState *cs, pid_t pid);
|
2023-03-03 05:57:47 +03:00
|
|
|
|
2024-02-07 19:38:10 +03:00
|
|
|
/**
|
|
|
|
* gdb_syscall_entry() - inform gdb of syscall entry and yield control to it
|
|
|
|
* @cs: CPU
|
|
|
|
* @num: syscall number
|
|
|
|
*/
|
|
|
|
void gdb_syscall_entry(CPUState *cs, int num);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdb_syscall_entry() - inform gdb of syscall return and yield control to it
|
|
|
|
* @cs: CPU
|
|
|
|
* @num: syscall number
|
|
|
|
*/
|
|
|
|
void gdb_syscall_return(CPUState *cs, int num);
|
2023-03-03 05:57:47 +03:00
|
|
|
|
|
|
|
#endif /* GDBSTUB_USER_H */
|