19 #include <sys/types.h>
237 (
unsigned char *)&ptr)) {
240 rsrc_id - 1,rsrc_id,ptr,tsrm_ls);
253 static struct value *php_EG(
struct target *target,
tid_t tid,
char *name) {
257 struct value *retval = NULL;
273 if (!ptstate->ztsinfo.tsrm_ls) {
274 verror(
"EG struct not yet loaded and no ZTS tsrm_ls yet!\n");
278 ptstate->EG = php_TSRMG(target,ptstate->ztsinfo.tsrm_ls,
282 verror(
"could not load executor_globals struct"
283 " for thread %"PRIiTID"!\n",tid);
289 verror(
"EG not loaded for non-ZTS php -- BUG?!\n");
303 VLVAL(target->
base,ptstate->base_tlctxt,ptstate->EG,name,
309 verror(
"failed to load EG(%s) in thread %"PRIiTID"!\n",name,tid);
313 #define PHP_UTIL_ZEND_HASH_APPLY_FREE 0
314 #define PHP_UTIL_ZEND_HASH_APPLY_SAVE 1 << 0
315 #define PHP_UTIL_ZEND_HASH_APPLY_STOP 1 << 1
321 static int php_util_zend_hash_apply(
struct target *target,
325 int f_wants_key,
void *fpriv) {
326 ADDR pData,pListNext;
327 struct value *next_k,*next_v;
328 struct value *bucket_v = NULL;
329 struct value *next_bucket_v = NULL;
334 if (pListNext == 0) {
349 verror(
"NULL data in zend_hash; skipping!\n");
372 rc = f(target,tlctxt,next_k,next_v,fpriv);
396 &next_bucket_v,errout);
398 bucket_v = next_bucket_v;
402 verror(
"error loading member from zend_hash Bucket!\n");
428 static struct symbol *php_debugfile_add_root(
struct target *target,
438 if (0 && strcmp(filename,
"Reflection") == 0)
452 #define PHP_ZEND_INTERNAL_FUNCTION 1U
453 #define PHP_ZEND_USER_FUNCTION 2U
454 #define PHP_ZEND_OVERLOADED_FUNCTION 3U
455 #define PHP_ZEND_EVAL_CODE 4U
456 #define PHP_ZEND_OVERLOADED_FUNCTION_TEMPORARY 5U
458 static int php_debugfile_add_function(
struct target *base,
460 struct value *zend_hash_key_v,
461 struct value *zend_function_v,
467 struct value *v = NULL;
468 unsigned int ftype = 0;
469 struct symbol *
root = NULL;
470 struct target *target;
472 unsigned int num_args;
474 struct symbol *arg_symbol;
479 unsigned int srcline = 0;
513 root = php_debugfile_add_root(base,debugfile,
v_string(v));
520 "internal_function.module.name",NULL,
523 root = php_debugfile_add_root(base,debugfile,
534 "common.function_name",NULL,
537 verror(
"could not read function name for zend_function 0x%"PRIxADDR";"
568 for (i = 0; i < num_args; ++
i) {
572 vwarn(
"could not load arg %d for function %s",
592 argslot =
malloc(
sizeof(*argslot));
611 static struct symbol *php_target_get_base_type_symbol(
struct target *target,
616 return ((
struct php_state *)(target->
state))->base_symbols[stype];
619 static int php_debugfile_add_constant(
struct target *base,
621 struct value *zend_hash_key_v,
622 struct value *zend_zval_v,
626 unsigned char zvtype = 0;
627 struct target *target;
630 struct symbol *symbol_base_type;
631 int symbol_base_type_size;
641 if (!zend_hash_key_v || !
v_string(zend_hash_key_v)) {
651 "class '%s' constant '%s' zval 0x%"PRIxADDR" is type %d\n",
656 verror(
"class '%s' constant '%s' is non-base type %d; ignoring!\n",
667 symbol_base_type = php_target_get_base_type_symbol(target,zvtype);
668 symbol->
datatype = symbol_base_type;
675 buf =
malloc(symbol_base_type_size);
681 buf =
malloc(symbol_base_type_size);
691 verror(
"constant string length %d too big; skipping!\n",slen);
695 verror(
"constant string length %d too small; skipping!\n",slen);
703 (
unsigned long)slen,(
unsigned char *)buf);
724 #define PHP_ZEND_INTERNAL_CLASS 1
725 #define PHP_ZEND_USER_CLASS 2
727 static int php_debugfile_add_class(
struct target *base,
729 struct value *zend_hash_key_v,
730 struct value *zend_class_entry_v,
735 struct symbol *symbol;
736 struct symbol *old_current_symbol;
737 struct value *v = NULL;
739 struct symbol *
root = NULL;
741 struct target *target;
771 root = php_debugfile_add_root(base,debugfile,
v_string(v));
777 "info.internal.module.name",NULL,
780 root = php_debugfile_add_root(base,debugfile,
791 zend_class_entry_v,
"name",NULL,
794 verror(
"could not read class name for zend_class_entry 0x%"PRIxADDR";"
795 " skipping!\n",
value_addr(zend_class_entry_v));
823 zend_class_entry_v,
"function_table",NULL,
826 verror(
"could not load function_table for class '%s'; skipping it!\n",
832 php_util_zend_hash_apply(tlctxt->
thread->
target,tlctxt,v,
834 php_debugfile_add_function,0,pdi);
841 zend_class_entry_v,
"constants_table",NULL,
844 verror(
"could not load constants_table for class '%s'; skipping it!\n",
850 php_util_zend_hash_apply(tlctxt->
thread->
target,tlctxt,v,
852 php_debugfile_add_constant,1,pdi);
861 verror(
"error parsing zend_class_entry value at 0x%"PRIxADDR"!\n",
866 static int php_populate_debugfile(
struct target *target,
884 v = php_EG(target,base_tlctxt->
thread->
tid,
"function_table");
886 verror(
"could not load EG(function_table)!\n");
891 php_debugfile_add_function,0,&pdi);
894 v = php_EG(target,base_tlctxt->
thread->
tid,
"class_table");
896 verror(
"could not load EG(class_table)!\n");
900 php_util_zend_hash_apply(base,base_tlctxt,v,
902 php_debugfile_add_class,0,&pdi);
928 #define php_zhash_foreach_loadtype(target,zhash_val,lpc,value,value_type)
934 struct symbol *type);
941 pspec =
calloc(1,
sizeof(*pspec));
953 static int php_snprintf(
struct target *target,
char *buf,
int bufsiz);
954 static int php_init(
struct target *target);
955 static int php_postloadinit(
struct target *target);
956 static int php_attach(
struct target *target);
957 static int php_detach(
struct target *target,
int stay_paused);
958 static int php_fini(
struct target *target);
959 static int php_loadspaces(
struct target *target);
960 static int php_loadregions(
struct target *target,
struct addrspace *space);
961 static int php_loaddebugfiles(
struct target *target,
965 static int php_pause(
struct target *target,
int nowait);
966 static int php_resume(
struct target *target);
967 static unsigned char *php_read(
struct target *target,
ADDR addr,
968 unsigned long length,
unsigned char *buf);
969 static unsigned long php_write(
struct target *target,
ADDR addr,
970 unsigned long length,
unsigned char *buf);
971 static struct value *php_read_symbol(
struct target *target,
976 static tid_t php_gettid(
struct target *target);
977 static void php_free_thread_state(
struct target *target,
void *state);
978 static struct array_list *php_list_available_tids(
struct target *target);
979 static struct target_thread *php_load_thread(
struct target *target,
980 tid_t tid,
int force);
981 static struct target_thread *php_load_current_thread(
struct target *target,
983 static int php_load_all_threads(
struct target *target,
int force);
984 static int php_load_available_threads(
struct target *target,
int force);
985 static int php_flush_thread(
struct target *target,
tid_t tid);
986 static int php_flush_current_thread(
struct target *target);
987 static int php_flush_all_threads(
struct target *target);
988 static int php_invalidate_thread(
struct target *target,
990 static int php_thread_snprintf(
struct target *target,
992 char *buf,
int bufsiz,
993 int detail,
char *sep,
char *kvsep);
994 static REGVAL php_read_reg(
struct target *target,
tid_t tid,
REG reg);
1003 static int php_probe_register_symbol(
struct target *target,
tid_t tid,
1010 struct target *overlay);
1012 struct target *overlay);
1020 .attach = php_attach,
1021 .detach = php_detach,
1023 .loadspaces = php_loadspaces,
1024 .loadregions = php_loadregions,
1025 .loaddebugfiles = php_loaddebugfiles,
1026 .postloadinit = php_postloadinit,
1029 .instantiate_overlay = NULL,
1031 .status = php_status,
1033 .resume = php_resume,
1039 .read_symbol = php_read_symbol,
1041 .gettid = php_gettid,
1042 .free_thread_state = php_free_thread_state,
1047 .load_available_threads = php_load_all_threads,
1048 .load_thread = php_load_thread,
1049 .load_current_thread = php_load_current_thread,
1050 .load_all_threads = php_load_all_threads,
1051 .pause_thread = NULL,
1052 .flush_thread = php_flush_thread,
1053 .flush_current_thread = php_flush_current_thread,
1054 .flush_all_threads = php_flush_all_threads,
1055 .invalidate_thread = php_invalidate_thread,
1056 .thread_snprintf = php_thread_snprintf,
1058 .attach_evloop = NULL,
1059 .detach_evloop = NULL,
1061 .readreg = php_read_reg,
1062 .writereg = php_write_reg,
1064 .unwind = php_unwind,
1065 .unwind_read_reg = php_unwind_read_reg,
1066 .unwind_prev = php_unwind_prev,
1068 .probe_register_symbol = php_probe_register_symbol,
1074 static int php_snprintf(
struct target *target,
char *buf,
int bufsiz) {
1078 static int php_init(
struct target *target) {
1082 struct target *base = target->
base;
1086 verror(
"PHP driver cannot leave target process closed on exit!\n");
1104 #if __WORDSIZE == 64
1118 verror(
"could not load base tid %d!\n",base_tid);
1128 vwarn(
"target->base_thread does not match with just-loaded thread"
1129 " for %d; pid wraparound caused stale thread??\n",base_tid);
1137 vwarn(
"auto-enabling SEMI_STRICT bpmode on PHP target.\n");
1151 ptstate =
calloc(1,
sizeof(*ptstate));
1164 static int php_fini(
struct target *target) {
1180 static int php_attach(
struct target *target) {
1183 struct target *base = target->
base;
1191 ADDR derefed_tsrm_ls = 0;
1196 verror(
"could not pause base target %s!\n",base->
name);
1217 "could not find compiler_globals; checking for ZTS\n");
1222 verror(
"could not find compiler_globals nor compiler_globals_id;"
1223 " cannot attach to this PHP!\n");
1251 NULL,&ptstate->
CG,errout);
1253 NULL,&ptstate->
EG,errout);
1264 verror(
"could not lookup struct _zend_compiler_globals; fatal!\n");
1274 verror(
"could not lookup struct _zend_executor_globals; fatal!\n");
1284 verror(
"could not lookup union _zend_function; fatal!\n");
1294 verror(
"could not lookup struct _zend_class_entry; fatal!\n");
1306 verror(
"could not lookup struct _zval_struct; fatal!\n");
1320 verror(
"could not lookup struct _zend_arg_info; fatal!\n");
1333 verror(
"could not lookup zend_do_fcall_common_helper_SPEC;"
1334 " cannot probe; fatal\n");
1342 "execute_data",NULL);
1344 verror(
"could not lookup zend_do_fcall_common_helper_SPEC.execute_data arg"
1345 "; cannot probe; fatal!\n");
1355 verror(
"could not lookup zend_leave_helper_SPEC;"
1356 " cannot probe; fatal\n");
1370 verror(
"failed to unwind stack to see if php is executing scripts;"
1371 " will probe for execution!\n");
1377 || strcmp(
"zend_execute_scripts",
1390 verror(
"could not find 'tsrm_ls' arg to '%s'; cannot"
1391 " infer TLS base pointer for PHP thread %d!\n",
1398 verror(
"could not load 'tsrm_ls' arg to '%s'; cannot"
1399 " infer TLS base pointer for PHP thread %d!\n",
1410 (
unsigned char *)&derefed_tsrm_ls)) {
1431 vwarn(
"PHP thread %d is executing scripts, but could not find"
1432 " tsrm_ls; will look later!\n",target->
base_tid);
1435 php_populate_debugfile(target,pstate->
debugfile);
1445 static int php_detach(
struct target *target,
int stay_paused) {
1452 static int php_loadspaces(
struct target *target) {
1473 static int php_loadregions(
struct target *target,
struct addrspace *
space) {
1492 static int php_loaddebugfiles(
struct target *target,
1498 struct symbol *base;
1505 php_snprintf(target,buf,
sizeof(buf));
1587 php_populate_debugfile(target,pstate->
debugfile);
1592 static int php_postloadinit(
struct target *target) {
1597 static int php_set_active_probing(
struct target *target,
1599 verror(
"active probing not supported\n");
1608 static int php_pause(
struct target *target,
int nowait) {
1619 static int php_resume(
struct target *target) {
1630 static unsigned char *php_read(
struct target *target,
ADDR addr,
1631 unsigned long length,
unsigned char *buf) {
1635 static unsigned long php_write(
struct target *target,
ADDR addr,
1636 unsigned long length,
unsigned char *buf) {
1640 static struct value *php_zval_to_value(
struct target *target,
1642 struct value *zval_v,
1646 unsigned char zvtype = 0;
1647 struct value *v = NULL;
1694 verror(
"constant string length %d too big; skipping!\n",slen);
1697 else if (slen < 1) {
1698 verror(
"constant string length %d too small; skipping!\n",slen);
1710 (
unsigned long)slen,(
unsigned char *)v->
buf);
1711 v->
buf[slen] =
'\0';
1715 vwarn(
"unsupported zval type %d!\n",zvtype);
1728 static struct value *php_read_symbol(
struct target *target,
1730 struct bsymbol *bsymbol,
1733 struct value *zval_v;
1735 struct symbol *symbol;
1739 struct value *EG_argument_stack_v = NULL;
1740 ADDR stack_top_addr;
1742 long unsigned int arg_count;
1743 struct symbol *parent;
1745 struct target *
base;
1753 base = target->
base;
1786 if (tlctxtf && tlctxtf->
frame > 0) {
1805 VLVAR(base,base_tlctxt,EX_v,
"opline.extended_value",
1813 memcpy(&argslot,argslotdata,len);
1815 verror(
"BUG: bad argslot %d for function %s!\n",
1820 else if (argslot >= (
int)arg_count) {
1823 "argslot %d exceeds arg_count %lu for function %s"
1824 " and no default value; exception will be thrown!\n",
1838 "symbol %s: loaded default param value len %d\n",
1844 "trying to load arg %s in slot %d for function %s\n",
1848 if (tlctxtf && tlctxtf->
frame > 0) {
1849 VLVAR(base,base_tlctxt,EX_v,
"function_state.arguments",
1853 EG_argument_stack_v =
1854 php_EG(target,tlctxt->
thread->
tid,
"argument_stack");
1855 if (!EG_argument_stack_v) {
1856 verror(
"could not load argstack!\n");
1861 &stack_top_addr,errout);
1871 if (tlctxtf && tlctxtf->
frame == 0)
1872 stack_top_addr -= 8;
1884 value = php_zval_to_value(target,tlctxt,zval_v,bsymbol);
1896 "symbol %s: loaded default const value len %d\n",
1900 verror(
"cannot load var symbol %s; unsupported!\n",
1909 if (EG_argument_stack_v)
1914 static tid_t php_gettid(
struct target *target) {
1923 tthread = php_load_current_thread(target,0);
1925 verror(
"could not load current thread to get TID!\n");
1929 return tthread->
tid;
1932 static void php_free_thread_state(
struct target *target,
void *
state) {
1945 static int __is_our_tid(
struct target *target,
tid_t tid) {
1946 if (g_hash_table_lookup(target->
threads,(gpointer)(uintptr_t)tid))
1952 static struct array_list *php_list_available_tids(
struct target *target) {
1955 retval = array_list_create(1);
1956 array_list_append(retval,(
void *)(uintptr_t)target->
base_tid);
1961 static struct target_thread *php_load_thread(
struct target *target,
1962 tid_t tid,
int force) {
1970 php_load_current_thread(
struct target *target,
int force) {
1975 verror(
"could not load base target current thread: %s\n",
1982 if (!__is_our_tid(target,uthread->
tid)) {
1984 "base target current tid %d is not in tgid %d!\n",
1997 static int php_load_all_threads(
struct target *target,
int force) {
1998 if (php_load_thread(target,target->
base_tid,force))
2003 static int php_load_available_threads(
struct target *target,
2005 if (php_load_thread(target,target->
base_tid,force))
2010 static int php_flush_thread(
struct target *target,
tid_t tid) {
2017 if (!__is_our_tid(target,tid)) {
2036 static int php_flush_current_thread(
struct target *target) {
2042 static int php_flush_all_threads(
struct target *target) {
2046 static int php_invalidate_thread(
struct target *target,
2062 static int php_thread_snprintf(
struct target *target,
2064 char *buf,
int bufsiz,
2065 int detail,
char *sep,
char *kvsep) {
2066 if (!__is_our_tid(target,tthread->
tid)) {
2067 verror(
"tid %d is not in tgid %d!\n",
2074 buf,bufsiz,detail,sep,kvsep);
2080 static REGVAL php_read_reg(
struct target *target,
tid_t tid,
REG reg) {
2084 static int php_write_reg(
struct target *target,
tid_t tid,
REG reg,
2093 struct bsymbol *bsymbol;
2097 struct value *zend_function_v;
2098 struct target *
base;
2099 ADDR zend_function_addr;
2102 base = target->
base;
2118 php_EG(target,tid,
"current_execute_data");
2120 verror(
"could not load execute_data arg; cannot determine which"
2121 " function is going to execute; skipping!\n");
2128 "function_state.function",NULL,
2130 if (!zend_function_v) {
2131 verror(
"could not load execute_data->function_state.function; cannot"
2132 " determine which function is executing; skipping!\n");
2136 zend_function_addr =
value_addr(zend_function_v);
2138 zend_function_v = NULL;
2142 verror(
"did not find PHP function symbol for zend_function"
2144 zend_function_addr);
2154 tlctxt->
frames = array_list_create(8);
2164 tlctxtf =
calloc(1,
sizeof(*tlctxtf));
2165 tlctxtf->
tlctxt = tlctxt;
2170 pfstate =
calloc(1,
sizeof(*pfstate));
2173 tlctxtf->
priv = pfstate;
2175 array_list_append(tlctxt->
frames,tlctxtf);
2191 ADDR prev_execute_data_addr;
2192 struct value *prev_execute_data_v = NULL;
2193 struct value *zend_function_v = NULL;
2194 ADDR zend_function_addr;
2195 struct bsymbol *bsymbol = NULL;
2196 struct target *target;
2197 struct target *
base;
2201 base = target->
base;
2222 if (!prev_execute_data_addr) {
2224 "stopping unwind at current frame %d; no prior frames",
2240 prev_execute_data_v,
2241 "function_state.function",NULL,
2243 if (!zend_function_v) {
2244 verror(
"could not load prev_execute_data->function_state.function; cannot"
2245 " determine which function is executing; stopping unwind!\n");
2249 zend_function_addr =
value_addr(zend_function_v);
2251 zend_function_v = NULL;
2255 verror(
"did not find PHP function symbol for zend_function"
2256 " 0x%"PRIxADDR"; stopping unwind!\n",
2257 zend_function_addr);
2269 new =
calloc(1,
sizeof(*
new));
2270 new->tlctxt = tlctxt;
2271 new->frame = array_list_len(tlctxt->
frames);
2272 new->bsymbol = bsymbol;
2273 new->registers = NULL;
2275 pfstate =
calloc(1,
sizeof(*pfstate));
2278 new->priv = pfstate;
2280 array_list_append(tlctxt->
frames,
new);
2286 "unwind created new previous frame %d for function '%s'\n",
2294 if (zend_function_v)
2296 if (prev_execute_data_v)
2304 static int php_probe_fini(
struct probe *
probe) {
2312 if (ptstate->
fprobe == probe)
2316 else if (ptstate->
vprobe == probe)
2322 static struct probe_ops php_probe_ops = {
2323 .
fini = php_probe_fini,
2326 static result_t __php_function_probe_handler(
int type,
2327 struct probe *probe,
2329 struct probe *trigger,
2330 struct probe *basep) {
2335 ADDR zend_function_addr;
2336 struct bsymbol *bsymbol;
2337 struct target *target;
2340 struct target *
base;
2342 struct value *zend_function_v;
2345 target = (
struct target *)handler_data;
2364 verror(
"could not load execute_data arg; cannot determine which"
2365 " function is going to execute; skipping!\n");
2372 "function_state.function",NULL,
2374 if (!zend_function_v) {
2375 verror(
"could not load execute_data->function_state.function; cannot"
2376 " determine which function is executing; skipping!\n");
2380 zend_function_addr =
value_addr(zend_function_v);
2382 zend_function_v = NULL;
2386 verror(
"did not find PHP function symbol for zend_function"
2388 zend_function_addr);
2399 list = probe->
sinks;
2401 ptmp = (
struct probe *)list->data;
2404 if (!ptmp->
bsymbol || !bsymbol
2437 list = g_list_next(list);
2442 stack_frame =
calloc(1,
sizeof(*stack_frame));
2454 static result_t php_function_return_probe_pre_handler(
struct probe *probe,
2455 tid_t tid,
void *handler_data,
2456 struct probe *trigger,
2457 struct probe *basep) {
2458 struct target *target;
2468 struct bsymbol *bsymbol;
2470 target = (
struct target *)handler_data;
2483 bsymbol = stack_frame->
bsymbol;
2492 list = probe->
sinks;
2494 ptmp = (
struct probe *)list->data;
2497 if (!ptmp->
bsymbol || !bsymbol
2523 list = g_list_next(list);
2544 static result_t php_function_probe_pre_handler (
struct probe *probe,
2545 tid_t tid,
void *handler_data,
2546 struct probe *trigger,
2547 struct probe *base) {
2548 volatile result_t ret = __php_function_probe_handler(1,probe,tid,handler_data,trigger,base);
2552 static result_t php_function_probe_post_handler(
struct probe *probe,
2553 tid_t tid,
void *handler_data,
2554 struct probe *trigger,
2555 struct probe *base) {
2556 volatile result_t ret = __php_function_probe_handler(2,probe,tid,handler_data,trigger,base);
2560 static int php_insert_function_probes(
struct target *target,
tid_t tid) {
2579 verror(
"no fcall helper symbol; cannot probe!\n");
2593 snprintf(buf,
sizeof(buf),
"php__%s__%d",
2596 php_function_probe_pre_handler,
2597 php_function_return_probe_pre_handler,
2627 static int php_probe_register_symbol(
struct target *target,
tid_t tid,
2628 struct probe *probe,
struct bsymbol *bsymbol,
2634 struct symbol *symbol;
2653 php_insert_function_probes(target,tid);
2656 verror(
"watchpoints not yet supported!\n");
2670 RHOLD(bsymbol,probe);
2683 struct target *overlay) {
2688 struct target *overlay) {
2767 if (rc != (
unsigned char *)pval) {
2769 real_addr,strerror(errno));
2785 (
unsigned char *)&pval);
2788 pval,real_addr,strerror(errno));
2797 *real_addr = obj_addr;
2803 *obj_addr = real_addr;
struct php_state::@29 ztsinfo
int debugfile_add_type(struct debugfile *debugfile, struct symbol *symbol)
int debugfile_insert_root(struct debugfile *debugfile, struct symbol *symbol)
#define PHP_UTIL_ZEND_HASH_APPLY_STOP
int symbol_insert_symbol(struct symbol *parent, struct symbol *child)
struct value * target_load_symbol(struct target *target, struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol, load_flags_t flags)
struct value * target_load_type(struct target *target, struct symbol *type, ADDR addr, load_flags_t flags)
#define vwarnopt(level, area, flags, format,...)
#define PHP_UTIL_ZEND_HASH_APPLY_SAVE
struct value * value_create_noalloc(struct target_thread *thread, struct memrange *range, struct lsymbol *lsymbol, struct symbol *type)
struct symbol * symbol_find_parent(struct symbol *symbol)
int __php_location_ops_getregno(struct location_ctxt *lctxt, common_reg_t creg, REG *o_reg)
struct symbol * zend_arg_info_type
struct symbol * current_symbol
int debugfile_symbol_counter
struct bsymbol * fprobe_func
struct value * current_execute_data_v
probe_handler_t pre_handler
unsigned char *(* read)(struct target *target, ADDR addr, unsigned long length, unsigned char *buf)
void symbol_set_bytesize(struct symbol *s, uint32_t b)
struct array_list * frames
REFCNT lsymbol_release(struct lsymbol *lsymbol)
struct debugfile * debugfile
#define VLS(target, tlctxt, varstr, loadflags, outvarptr, outvalueptr, errlabel)
int symbol_set_constval(struct symbol *symbol, void *value, int len, int copy)
struct memregion * region
int(* php_util_zend_hash_apply_func_t)(struct target *target, struct target_location_ctxt *tlctxt, struct value *k, struct value *v, void *priv)
struct symbol * symbol_create(symbol_type_t symtype, symbol_source_t source, char *name, int name_copy, SMOFFSET offset, load_type_t loadtype, struct scope *scope)
int __php_location_ops_readword(struct location_ctxt *lctxt, ADDR real_addr, ADDR *pval)
struct scope * symbol_read_owned_scope(struct symbol *symbol)
int __php_location_ops_readipreg(struct location_ctxt *lctxt, REGVAL *regval)
struct symbol ** base_symbols
#define PHP_UTIL_ZEND_HASH_APPLY_FREE
static uint64_t unsigned int i
struct bsymbol * target_lookup_sym(struct target *target, const char *name, const char *delim, char *srcfile, symbol_type_flag_t ftype)
int __php_location_ops_getaddrsize(struct location_ctxt *lctxt)
struct symbol * _zend_executor_globals_type
#define VLV(target, tlctxt, invalue, varstr, loadflags, outvarptr, outvalueptr, errlabel)
int target_resume(struct target *target)
struct target_location_ctxt * target_location_ctxt_create_from_bsymbol(struct target *target, tid_t tid, struct bsymbol *bsymbol)
struct symbol * __php_location_ops_getsymbol(struct location_ctxt *lctxt)
struct target_thread * base_thread
struct target_location_ctxt * tlctxt
struct php_spec * php_build_spec(void)
void php_free_spec(struct php_spec *spec)
int target_pause(struct target *target)
ADDR symbol_get_addr(struct symbol *symbol)
struct target_thread * global_thread
int __php_location_ops_writereg(struct location_ctxt *lctxt, REG regno, REGVAL regval)
uint32_t symbol_get_bytesize(struct symbol *symbol)
#define PHP_ZEND_INTERNAL_CLASS
void symbol_set_srcline(struct symbol *s, int sl)
char * bsymbol_get_name(struct bsymbol *bsymbol)
int php_singlestep_end(struct target *target, tid_t tid, struct target *overlay)
#define PHP_ZEND_INTERNAL_FUNCTION
int target_associate_debugfile(struct target *target, struct memregion *region, struct debugfile *debugfile)
struct value * execute_data_v
int(* writereg)(struct target *target, tid_t tid, REG reg, REGVAL value)
#define verror(format,...)
int symbol_is_parameter(struct symbol *symbol)
unsigned char * target_read_addr(struct target *target, ADDR addr, unsigned long length, unsigned char *buf)
int __php_location_ops_cachereg(struct location_ctxt *lctxt, REG regno, REGVAL regval)
struct symbol * _zend_compiler_globals_type
struct symbol * symbol_get_datatype(struct symbol *symbol)
struct symbol * builtin_root
#define SYMBOLX_VAR_LOC(sym)
int __php_location_ops_setcurrentframe(struct location_ctxt *lctxt, int frame)
struct lsymbol * debugfile_lookup_addr(struct debugfile *debugfile, ADDR addr)
struct memregion * memregion_create(struct addrspace *space, region_type_t type, char *name)
#define vwarn(format,...)
struct target_location_ctxt_frame * target_location_ctxt_get_frame(struct target_location_ctxt *tlctxt, int frame)
int(* thread_snprintf)(struct target *target, struct target_thread *tthread, char *buf, int bufsiz, int detail, char *sep, char *key_val_sep)
#define LOCATION_GET_DATA(loc, buf, buflen)
enum php_base_symbol php_base_symbol_t
struct target_thread * target_load_thread(struct target *target, tid_t tid, int force)
struct probe * probe_register_source(struct probe *sink, struct probe *src)
int symbol_set_encoding(struct symbol *symbol, encoding_t num)
struct memrange * memrange_create(struct memregion *region, ADDR start, ADDR end, OFFSET offset, unsigned int prot_flags)
int __php_location_ops_unrelocate(struct location_ctxt *lctxt, ADDR real_addr, ADDR *obj_addr)
int __php_location_ops_writeword(struct location_ctxt *lctxt, ADDR real_addr, ADDR pval)
#define PHP_ZEND_USER_FUNCTION
struct target_thread * target_load_current_thread(struct target *target, int force)
int symbol_set_location(struct symbol *symbol, struct location *loc)
REFCNT bsymbol_release(struct bsymbol *bsymbol)
struct target_thread * current_thread
datatype_code_t datatype_code
REFCNT debugfile_free(struct debugfile *debugfile, int force)
struct symbol * zend_function_type
struct array_list * target_list_tids(struct target *target)
int probe_free(struct probe *probe, int force)
struct target_location_ctxt_frame * target_location_ctxt_prev(struct target_location_ctxt *tlctxt)
int value_refresh(struct value *value, int recursive)
int(* fini)(struct probe *probe)
#define LOGDUMPPROBE_NL(dl, la, lt, p)
#define VLVAR(target, tlctxt, invalue, varstr, loadflags, outvarptr, errlabel)
struct value * value_create_type(struct target_thread *thread, struct memrange *range, struct symbol *type)
void value_free(struct value *value)
int location_set_runtime(struct location *l, char *data, int len, int nocopy)
struct value * target_load_value_member(struct target *target, struct target_location_ctxt *tlctxt, struct value *old_value, const char *member, const char *delim, load_flags_t flags)
#define PHP_ZEND_TYPE_IS_BASE(type)
struct bsymbol * target_lookup_sym_addr(struct target *target, ADDR addr)
int target_location_ctxt_unwind(struct target_location_ctxt *tlctxt)
int debugfile_add_global(struct debugfile *debugfile, struct symbol *symbol)
struct debugfile * debugfile_create_basic(debugfile_type_t dtype, debugfile_type_flags_t dtflags, char *filename, struct debugfile_load_opts *opts)
struct value * value_clone(struct value *in)
#define PROBE_SAFE_OP_ARGS(probe, op,...)
void symbol_set_addr(struct symbol *s, ADDR a)
struct probe * probe_create(struct target *target, tid_t tid, struct probe_ops *pops, const char *name, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data, int autofree, int tracked)
struct target_thread * thread
struct target_ops php_ops
#define vdebug(devel, areas, flags, format,...)
ADDR v_addr(struct value *v)
struct symbol * zend_zval_type
int(* setcurrentframe)(struct location_ctxt *lctxt, int frame)
struct target_location_ctxt_frame * target_location_ctxt_current_frame(struct target_location_ctxt *tlctxt)
struct location * location_create(void)
GHashTable * php_zhash_to_ghash(struct target *target, struct value *zhash)
struct value * value_create(struct target_thread *thread, struct memrange *range, struct lsymbol *lsymbol, struct symbol *type)
void * calloc(size_t nmemb, size_t size)
#define VLVAL(target, tlctxt, invalue, varstr, loadflags, outvalueptr, errlabel)
void target_thread_set_status(struct target_thread *tthread, thread_status_t status)
int __php_location_ops_relocate(struct location_ctxt *lctxt, ADDR obj_addr, ADDR *real_addr)
int probe_disable(struct probe *probe)
struct bsymbol * fprobe_func_execute_data_arg
struct debugfile * debugfile
struct symbol * debugfile_lookup_root_name(struct debugfile *debugfile, char *name)
int php_singlestep(struct target *target, tid_t tid, int isbp, struct target *overlay)
int __php_location_ops_readreg(struct location_ctxt *lctxt, REG regno, REGVAL *regval)
target_status_t target_status(struct target *target)
char * v_string(struct value *v)
void target_reuse_thread_as_global(struct target *target, struct target_thread *thread)
#define symbol_set_parameter(s)
struct lsymbol * bsymbol_get_lsymbol(struct bsymbol *bsymbol)
struct target_location_ctxt * target_location_ctxt_create(struct target *target, tid_t tid, struct memregion *region)
struct location_ops php_location_ops
struct symbol * bsymbol_get_symbol(struct bsymbol *bsymbol)
#define vwarnc(format,...)
struct php_thread_state::@28 ztsinfo
struct value * php_zhash_find(struct target *target, struct value *zhash, char *key, struct symbol *type)
unsigned int is_executing
struct symbol * symbol_get_member(struct symbol *symbol, char *memberlist, const char *delim)
struct target_location_ctxt * base_tlctxt
struct value * target_load_symbol_member(struct target *target, struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol, const char *member, const char *delim, load_flags_t flags)
void target_location_ctxt_free(struct target_location_ctxt *tlctxt)
char * SYMBOL_TYPE(int n)
#define PHP_ZEND_USER_CLASS
int(* snprintf)(struct target *target, char *buf, int bufsiz)
struct value * current_execute_data_v
struct symbol * target_create_synthetic_type_pointer(struct target *target, struct symbol *type)
struct target_spec * spec
int probe_filter_check(struct probe *probe, tid_t tid, struct probe *trigger, int whence)
struct bsymbol * fprobe_func_return
char * symbol_get_name(struct symbol *symbol)
REGVAL(* readreg)(struct target *target, tid_t tid, REG reg)
struct location_ops * location_ops
struct symbol_root * root
void * malloc(size_t size)
#define PHP_BASE_SYMBOL_COUNT
struct target_thread * target_lookup_thread(struct target *target, tid_t tid)
void target_set_status(struct target *target, target_status_t status)
struct target_thread * thread
unsigned long(* write)(struct target *target, ADDR addr, unsigned long length, unsigned char *buf)
unsigned long target_write_addr(struct target *target, ADDR addr, unsigned long length, unsigned char *buf)
void debugfile_dump(struct debugfile *debugfile, struct dump_info *ud, int types, int globals, int symtabs, int elfsymtab, int doranges)
struct probe * fprobe_return
struct bsymbol * target_lookup_sym_member(struct target *target, struct bsymbol *bsymbol, const char *name, const char *delim)
struct target_location_ctxt * default_tlctxt
struct probe * probe_register_symbol(struct probe *probe, struct bsymbol *bsymbol, probepoint_style_t style, probepoint_whence_t whence, probepoint_watchsize_t watchsize)
#define SYMBOL_IS_FUNC(sym)
struct target_thread * target_create_thread(struct target *target, tid_t tid, void *tstate, void *tpstate)
struct symbol * zend_class_entry_ptr_type
ADDR value_addr(struct value *value)
struct location_ctxt * lctxt
struct symbol * zend_zval_ptr_type
probe_handler_t post_handler
struct memregion * region
#define SYMBOL_IS_VAR(sym)
struct addrspace * addrspace_create(struct target *target, char *name, ADDR tag)