Stackdb
Stackdb is a stackable, multi-target and -level source debugger and memory forensics library.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions | Variables
target_gdb.c File Reference
#include "config.h"
#include <errno.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/select.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <libgen.h>
#include <endian.h>
#include <gelf.h>
#include <elf.h>
#include <libelf.h>
#include <argp.h>
#include "common.h"
#include "arch.h"
#include "arch_x86.h"
#include "arch_x86_64.h"
#include "evloop.h"
#include "binfile.h"
#include "dwdebug.h"
#include "dwdebug_priv.h"
#include "target_api.h"
#include "target.h"
#include "target_arch_x86.h"
#include "target_os.h"
#include "probe_api.h"
#include "target_gdb.h"
#include "target_gdb_rsp.h"
#include <glib.h>
Include dependency graph for target_gdb.c:

Go to the source code of this file.

Macros

#define GDB_ARGP_HOST   0x650001
 
#define GDB_ARGP_PORT   0x650002
 
#define GDB_ARGP_UDP   0x650003
 
#define GDB_ARGP_SOCKFILE   0x650004
 
#define GDB_ARGP_IS_KVM   0x650005
 
#define GDB_ARGP_IS_QEMU   0x650006
 
#define GDB_ARGP_QEMU_QMP_HOST   0x650007
 
#define GDB_ARGP_QEMU_MEM_PATH   0x650008
 
#define GDB_ARGP_QEMU_QMP_PORT   0x650009
 
#define GDB_ARGP_CLEAR_MEM_CACHES   0x65000a
 
#define GDB_ARGP_MEMCACHE_MMAP_SIZE   0x65000b
 
#define GDB_ARGP_LIBVIRT_DOMAIN   0x65000c
 
#define CHECKTIDGLOBAL(tid)
 
#define CHECKTIDGLOBALORCURRENT(_T)
 

Functions

struct targetgdb_instantiate (struct target_spec *spec, struct evloop *evloop)
 
int gdb_instr_can_switch_context (struct target *target, ADDR addr)
 
int gdb_spec_to_argv (struct target_spec *spec, int *argc, char ***argv)
 
error_t gdb_argp_parse_opt (int key, char *arg, struct argp_state *state)
 
struct gdb_specgdb_build_spec (void)
 
void gdb_free_spec (struct gdb_spec *xspec)
 
int gdb_evloop_handler (int readfd, int fdtype, void *state)
 

Variables

struct gdb_helper_ops gdb_helper_ops_qemu
 
struct gdb_helper_ops gdb_helper_ops_builtin
 
struct target_ops gdb_ops
 
struct argp_option gdb_argp_opts []
 
struct argp gdb_argp
 
char * gdb_argp_header = "GDB Backend Options"
 

Macro Definition Documentation

#define CHECKTIDGLOBAL (   tid)
Value:
if ((tid) != TID_GLOBAL) { \
verror("only TID_GLOBAL supported, not tid %d!\n",tid); \
errno = EINVAL; \
return -1; \
}
#define verror(format,...)
Definition: log.h:30
#define TID_GLOBAL
Definition: target_api.h:145

Definition at line 2841 of file target_gdb.c.

#define CHECKTIDGLOBALORCURRENT (   _T)
Value:
if ((_T) != TID_GLOBAL \
verror("only TID_GLOBAL/current tid supported, not tid %d!\n",(_T)); \
errno = EINVAL; \
return -1; \
}
#define verror(format,...)
Definition: log.h:30
struct target_thread * current_thread
Definition: target_api.h:2680
#define TID_GLOBAL
Definition: target_api.h:145

Definition at line 2848 of file target_gdb.c.

#define GDB_ARGP_CLEAR_MEM_CACHES   0x65000a

Definition at line 294 of file target_gdb.c.

#define GDB_ARGP_HOST   0x650001

Definition at line 285 of file target_gdb.c.

#define GDB_ARGP_IS_KVM   0x650005

Definition at line 289 of file target_gdb.c.

#define GDB_ARGP_IS_QEMU   0x650006

Definition at line 290 of file target_gdb.c.

#define GDB_ARGP_LIBVIRT_DOMAIN   0x65000c

Definition at line 296 of file target_gdb.c.

#define GDB_ARGP_MEMCACHE_MMAP_SIZE   0x65000b

Definition at line 295 of file target_gdb.c.

#define GDB_ARGP_PORT   0x650002

Definition at line 286 of file target_gdb.c.

#define GDB_ARGP_QEMU_MEM_PATH   0x650008

Definition at line 292 of file target_gdb.c.

#define GDB_ARGP_QEMU_QMP_HOST   0x650007

Definition at line 291 of file target_gdb.c.

#define GDB_ARGP_QEMU_QMP_PORT   0x650009

Definition at line 293 of file target_gdb.c.

#define GDB_ARGP_SOCKFILE   0x650004

Definition at line 288 of file target_gdb.c.

#define GDB_ARGP_UDP   0x650003

Definition at line 287 of file target_gdb.c.

Function Documentation

error_t gdb_argp_parse_opt ( int  key,
char *  arg,
struct argp_state *  state 
)

Definition at line 442 of file target_gdb.c.

struct gdb_spec* gdb_build_spec ( void  )

These are the only user-visible functions.

Definition at line 574 of file target_gdb.c.

int gdb_evloop_handler ( int  readfd,
int  fdtype,
void *  state 
)

Definition at line 1752 of file target_gdb.c.

void gdb_free_spec ( struct gdb_spec xspec)

Definition at line 583 of file target_gdb.c.

struct target * gdb_instantiate ( struct target_spec spec,
struct evloop evloop 
)

Definition at line 594 of file target_gdb.c.

int gdb_instr_can_switch_context ( struct target target,
ADDR  addr 
)
int gdb_spec_to_argv ( struct target_spec spec,
int *  argc,
char ***  argv 
)

Definition at line 331 of file target_gdb.c.

Variable Documentation

struct argp gdb_argp
Initial value:
= {
gdb_argp_opts,gdb_argp_parse_opt,NULL,NULL,NULL,NULL,NULL
}
struct argp_option gdb_argp_opts[]
Definition: target_gdb.c:298
error_t gdb_argp_parse_opt(int key, char *arg, struct argp_state *state)
Definition: target_gdb.c:442

Definition at line 565 of file target_gdb.c.

char* gdb_argp_header = "GDB Backend Options"

Definition at line 568 of file target_gdb.c.

struct argp_option gdb_argp_opts[]

Definition at line 298 of file target_gdb.c.

struct gdb_helper_ops gdb_helper_ops_builtin

Definition at line 233 of file target_gdb_helper_builtin.c.

struct gdb_helper_ops gdb_helper_ops_qemu

Definition at line 1090 of file target_gdb_helper_qemu.c.

struct target_ops gdb_ops

Definition at line 195 of file target_gdb.c.