summaryrefslogtreecommitdiffstats
path: root/debugger.h
blob: 6305e964fcd5659cab65a64fbd72ae8c368d6dda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#include <sys/user.h>
#include <unistd.h>

#include "console.h"
#include "list.h"

#define BREAKPOINT_INSN 0xcc

struct breakpoint {
    LINKEDLIST;
    unsigned long address;
    unsigned long stack;
    unsigned long orig;
    int enabled;
    int active;
};

struct map {
    LINKEDLIST;
    unsigned long start;
    unsigned long end;
    void *data;
};

struct state {
    LINKEDLIST;
    struct user_regs_struct regs;
    struct user_fpregs_struct fpregs;
    struct list maps;
};

struct tracee {
    struct list breaks;
    struct list states;
    struct state *state;
    pid_t id;
    int child;
    int stopped;
    int status;
    int signal;
    int cont;
    void *buff;
    size_t buffsize;
};

extern int dbg_process(struct tracee *dbg, pid_t pid);
extern int dbg_new_process(struct tracee *dbg, char **argv, struct console *cons);
extern int dbg_wait(struct tracee *dbg);
extern int dbg_stepin(struct tracee *dbg);
extern int dbg_stepover(struct tracee *dbg);
//extern int dbg_stepout(struct tracee *dbg);
extern int dbg_cont(struct tracee *dbg, int mode);
extern void *deref(struct tracee *dbg, unsigned long addr, size_t size);