gdb_syscall.h File Reference
#include <stdint.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/unistd.h>
#include <sys/time.h>
#include <stdio.h>
Include dependency graph for gdb_syscall.h:

Go to the source code of this file.

Classes

struct  gdb_stat_t
 GDB uses a specific version of the stat structure, 64 bytes in size. More...
 
struct  gdb_timeval_t
 GDB uses a specific version of the timeval structure, 12 bytes in size (manual says 8, which is wrong) More...
 
struct  GdbSyscallInfo
 GDB Syscall request information. More...
 

Typedefs

using gdb_syscall_callback_t = void(*)(const GdbSyscallInfo &info)
 GDB Syscall completion callback function. More...
 

Enumerations

enum  GdbSyscallCommand {
  eGDBSYS_open, eGDBSYS_close, eGDBSYS_read, eGDBSYS_write,
  eGDBSYS_lseek, eGDBSYS_rename, eGDBSYS_unlink, eGDBSYS_stat,
  eGDBSYS_fstat, eGDBSYS_gettimeofday, eGDBSYS_isatty, eGDBSYS_system
}
 Enumeration defining available commands. More...
 

Functions

int gdb_syscall (const GdbSyscallInfo &info)
 Stub function to perform a syscall. Implemented by GDB stub. More...
 
static int gdb_syscall_open (const char *filename, int flags, int mode, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Open a file on the host. More...
 
static int gdb_syscall_close (int fd, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Close a host file. More...
 
static int gdb_syscall_read (int fd, void *buffer, size_t bufSize, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Read data from a host file. More...
 
static int gdb_syscall_write (int fd, const void *buffer, size_t count, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Write data from a host file. More...
 
static int gdb_syscall_lseek (int fd, long offset, int whence, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Get/set current file pointer position in a host file. More...
 
static int gdb_syscall_rename (const char *oldpath, const char *newpath, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Rename a host file. More...
 
static int gdb_syscall_unlink (const char *pathname, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Unlink/remove/delete a host file. More...
 
static int gdb_syscall_stat (const char *pathname, gdb_stat_t *buf, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Obtain information about a host file given its name/path. More...
 
static int gdb_syscall_fstat (int fd, struct gdb_stat_t *buf, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Obtain information about a host file given its file handle. More...
 
static int gdb_syscall_gettimeofday (gdb_timeval_t *tv, void *tz, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Get current time of day from host, in UTC. More...
 
static int gdb_syscall_isatty (int fd, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Determine if the given file handle refers to a console/tty. More...
 
static int gdb_syscall_system (const char *command, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Invoke the 'system' command on the host. More...
 
static int gdb_console_read (void *buffer, size_t bufSize, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Read a line of text from the GDB console. More...
 
static int gdb_console_write (const void *buffer, size_t count, gdb_syscall_callback_t callback=nullptr, void *param=nullptr)
 Write text to the GDB console. More...