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
target_php.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013 The University of Utah
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef __TARGET_PHP_H__
20 #define __TARGET_PHP_H__
21 
22 extern struct target_ops php_ops;
23 extern struct location_ops php_location_ops;
24 
25 struct php_spec {
26  unsigned int nostatic:1;
27 };
28 
31  // XXX: what do we need to load variables in the function? etc.
32 };
33 
35  struct bsymbol *bsymbol;
37 };
38 
40  unsigned int is_executing:1;
41 
43  GSList *stack_frames;
44 
45  /*
46  * A default context for loading values from the underlying target
47  * in this thread; the region is the PHP binary's MAIN region; we
48  * get it by looking up the first symbol in php_attach.
49  *
50  * Of course, if you try to lookup or load a symbol in an extension,
51  * then you have to use a different tlctxt because the region (and
52  * debugfile!) will be wrong.
53  */
55 
56  struct {
58  } ztsinfo;
59 
60  struct value *CG;
61  struct value *EG;
62 
63  struct probe *fprobe;
65  struct probe *vprobe;
66 };
67 
68 /*
69  * We keep a special array of builtin symbols so
70  */
71 /* PHP ZEND data types */
72 #define PHP_ZEND_NULL 0
73 #define PHP_ZEND_LONG 1
74 #define PHP_ZEND_DOUBLE 2
75 #define PHP_ZEND_BOOL 3
76 #define PHP_ZEND_ARRAY 4
77 #define PHP_ZEND_OBJECT 5
78 #define PHP_ZEND_STRING 6
79 #define PHP_ZEND_RESOURCE 7
80 #define PHP_ZEND_CONSTANT 8
81 #define PHP_ZEND_CONSTANT_ARRAY 9
82 #define PHP_ZEND_CALLABLE 10
83 
84 typedef enum php_base_symbol {
92 #define PHP_BASE_SYMBOL_COUNT PHP_BASE_STRING + 1
93 
94 #define PHP_ZEND_TYPE_IS_BASE(type) \
95  ((type) == PHP_BASE_NULL || (type) == PHP_BASE_LONG \
96  || (type) == PHP_BASE_DOUBLE || (type) == PHP_BASE_BOOL \
97  || (type) == PHP_BASE_STRING)
98 
99 struct php_state {
100  unsigned int zts:1;
101 
103 
104  /*
105  * We're only going to have a single debugfile, even if we have
106  * multiple threads. Cache it here.
107  */
109 
110  struct {
111  /*
112  * These are the thread-local storage resource IDs for the
113  * compiler_globals and executor_globals structs.
114  */
115  int CG_id;
116  int EG_id;
117  } ztsinfo;
118 
122 
128 
132 
135 
136  //GHashTable *
137 };
138 
139 struct target *php_instantiate(struct target_spec *spec,
140  struct evloop *evloop);
141 struct php_spec *php_build_spec(void);
142 void php_free_spec(struct php_spec *xspec);
143 int php_spec_to_argv(struct target_spec *spec,int *argc,char ***argv);
144 
145 #endif /* __TARGET_PHP_H__ */
struct php_state::@29 ztsinfo
struct target_ops php_ops
Definition: target_php.c:1015
int php_spec_to_argv(struct target_spec *spec, int *argc, char ***argv)
struct target * php_instantiate(struct target_spec *spec, struct evloop *evloop)
struct probe * vprobe
Definition: target_php.h:65
struct symbol * zend_arg_info_type
Definition: target_php.h:127
int debugfile_symbol_counter
Definition: target_php.h:119
struct bsymbol * fprobe_func
Definition: target_php.h:129
struct value * EG
Definition: target_php.h:61
struct value * current_execute_data_v
Definition: target_php.h:36
struct debugfile * debugfile
Definition: target_php.h:108
struct symbol ** base_symbols
Definition: target_php.h:121
struct symbol * _zend_executor_globals_type
Definition: target_php.h:134
struct bsymbol * bsymbol
Definition: target_php.h:35
#define PHP_ZEND_ARRAY
Definition: target_php.h:76
#define PHP_ZEND_STRING
Definition: target_php.h:78
#define PHP_ZEND_DOUBLE
Definition: target_php.h:74
struct probe * fprobe
Definition: target_php.h:63
struct symbol * _zend_compiler_globals_type
Definition: target_php.h:133
struct symbol * builtin_root
Definition: target_php.h:120
Definition: evloop.h:66
enum php_base_symbol php_base_symbol_t
struct php_spec * php_build_spec(void)
Definition: target_php.c:938
struct symbol * zend_function_type
Definition: target_php.h:123
unsigned int nostatic
Definition: target_php.h:26
struct location_ops php_location_ops
Definition: target_php.c:2807
void php_free_spec(struct php_spec *xspec)
Definition: target_php.c:946
Definition: probe.h:308
#define PHP_ZEND_NULL
Definition: target_php.h:72
struct symbol * zend_zval_type
Definition: target_php.h:125
GSList * stack_frames
Definition: target_php.h:43
struct bsymbol * fprobe_func_execute_data_arg
Definition: target_php.h:130
uint32_t ADDR
Definition: common.h:64
struct php_thread_state::@28 ztsinfo
php_base_symbol
Definition: target_php.h:84
#define PHP_ZEND_LONG
Definition: target_php.h:73
unsigned int is_executing
Definition: target_php.h:40
struct target_location_ctxt * base_tlctxt
Definition: target_php.h:54
struct value * current_execute_data_v
Definition: target_php.h:42
struct target_spec * spec
Definition: target_api.h:2605
struct bsymbol * fprobe_func_return
Definition: target_php.h:131
struct probe * fprobe_return
Definition: target_php.h:64
#define PHP_ZEND_BOOL
Definition: target_php.h:75
struct target_location_ctxt * default_tlctxt
Definition: target_php.h:102
struct value * CG
Definition: target_php.h:60
struct symbol * zend_class_entry_ptr_type
Definition: target_php.h:124
struct symbol * zend_zval_ptr_type
Definition: target_php.h:126
unsigned int zts
Definition: target_php.h:100