File: scanmem.h

package info (click to toggle)
scanmem 0.07-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 624 kB
  • ctags: 229
  • sloc: ansic: 2,176; sh: 985; exp: 342; makefile: 8
file content (90 lines) | stat: -rw-r--r-- 2,423 bytes parent folder | download
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*

 $Id: scanmem.h,v 1.21 2007-06-05 01:45:35+01 taviso Exp $

*/

#ifndef _SCANMEM_INC
#define _SCANMEM_INC            /* include guard */

#include <stdint.h>
#include <sys/types.h>          /*lint !e537 */

#include "list.h"
#include "value.h"
#include "maps.h"

/*lint +libh(config.h) */

#include "config.h"

/* list of functions where i dont want to be warned about ignored return value */

/*lint -esym(534,detach,printversion,strftime,fflush,sleep) */

#ifndef PACKAGE_VERSION
# define  PACKAGE_VERSION "(unknown)"
#endif

#ifndef NDEBUG
# define eprintf(x, y...) fprintf(stderr, x, ## y)
#else
# define eprintf(x, y...)
#endif

#ifdef _lint
/*lint -save -e652 -e683 -e547 */
# define snprintf(a, b, c...) (((void) b), sprintf(a, ## c))
# define strtoll(a,b,c) ((long long) strtol(a,b,c))
# define WIFSTOPPED
# define sighandler_t _sigfunc_t
/*lint -restore */
/*lint -save -esym(526,getline,strdupa,strdup,strndupa,strtoll,pread) */
ssize_t getline(char **lineptr, size_t * n, FILE * stream);
char *strndupa(const char *s, size_t n);
char *strdupa(const char *s);
char *strdup(const char *s);
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
/*lint -restore */
#endif
#ifdef __CSURF__
# define waitpid(x,y,z) ((*(y)=0),-rand())
# define WIFSTOPPED(x) (rand())
# define ptrace(w,x,y,z) ((errno=rand()),(ptrace(w,x,y,z)))
#endif
#ifndef MIN
# define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif

/* global settings */
typedef struct {
    unsigned exit:1;
    pid_t target;
    list_t *matches;
    list_t *regions;
    list_t *commands;
} globals_t;

/* this structure represents one known match, its address and type. */
typedef struct {
    void *address;              /* address of variable */
    region_t *region;           /* region it belongs to */
    value_t lvalue;             /* last seen value */
    unsigned matchid;           /* unique identifier */
} match_t;


/* global settings */
extern globals_t globals;

bool detach(pid_t target);
bool setaddr(pid_t target, void *addr, const value_t * to);
bool checkmatches(list_t * matches, pid_t target, value_t value,
                  matchtype_t type);
bool searchregions(list_t * matches, const list_t * regions, pid_t target,
                value_t value, bool snapshot);
bool peekdata(pid_t pid, void *addr, value_t * result);
bool attach(pid_t target);
bool getcommand(globals_t * vars, char **line);
int printversion(FILE * fp);
#endif