45 g_hash_table_iter_init(&iter,pv->
nv);
46 while (g_hash_table_iter_next(&iter,&kp,&vp)) {
50 g_hash_table_iter_remove(&iter);
53 g_hash_table_iter_init(&iter,pv->
nr);
54 while (g_hash_table_iter_next(&iter,&kp,&vp)) {
58 g_hash_table_iter_remove(&iter);
69 g_hash_table_destroy(pv->
nv);
73 g_hash_table_destroy(pv->
nr);
82 pv =
calloc(1,
sizeof(*pv));
84 pv->
nv = g_hash_table_new(g_str_hash,g_str_equal);
85 pv->
nr = g_hash_table_new(g_str_hash,g_str_equal);
102 probe->
values = g_hash_table_new(g_direct_hash,g_direct_equal);
103 stack = (GSList *)g_hash_table_lookup(probe->
values,(gpointer)(uintptr_t)tid);
116 stack = g_slist_prepend(stack,pv);
117 g_hash_table_insert(probe->
values,(gpointer)(uintptr_t)tid,stack);
129 probe->
values = g_hash_table_new(g_direct_hash,g_direct_equal);
131 g_hash_table_lookup(probe->
values,(gpointer)(uintptr_t)tid);
142 g_hash_table_insert(probe->
values,(gpointer)(uintptr_t)tid,pv);
152 GSList *stack, *gsltmp;
158 g_hash_table_iter_init(&iter,probe->
values);
159 while (g_hash_table_iter_next(&iter,NULL,&vp)) {
160 stack = (GSList *)vp;
168 g_hash_table_destroy(probe->
values);
179 g_hash_table_iter_init(&iter,probe->
values);
180 while (g_hash_table_iter_next(&iter,NULL,&vp)) {
183 g_hash_table_destroy(probe->
values);
191 struct value *value_prev = NULL;
193 char *existing_name = NULL;
196 probe->
values = g_hash_table_new(g_direct_hash,g_direct_equal);
197 stack = (GSList *)g_hash_table_lookup(probe->
values,(gpointer)(uintptr_t)tid);
203 stack = g_slist_prepend(stack,pv);
204 g_hash_table_insert(probe->
values,(gpointer)(uintptr_t)tid,stack);
210 stack = g_slist_delete_link(stack,stack);
213 stack = g_slist_prepend(stack,pv);
214 g_hash_table_insert(
probe->
values,(gpointer)(uintptr_t)tid,stack);
222 if (g_hash_table_lookup_extended(v,name,(gpointer *)&existing_name,
223 (gpointer *)&value_prev) == TRUE) {
224 g_hash_table_remove(v,name);
230 g_hash_table_insert(v,strdup(name),
value);
238 struct value *value_prev;
242 probe->
values = g_hash_table_new(g_direct_hash,g_direct_equal);
245 g_hash_table_lookup(probe->
values,(gpointer)(uintptr_t)tid);
247 pv =
calloc(1,
sizeof(*pv));
248 pv->
nv = g_hash_table_new(g_str_hash,g_str_equal);
249 pv->
nr = g_hash_table_new(g_str_hash,g_str_equal);
250 g_hash_table_insert(probe->
values,(gpointer)(uintptr_t)tid,pv);
261 value_prev = (
struct value *)g_hash_table_lookup(v,name);
265 g_hash_table_insert(v,strdup(name),value);
271 int israw,
int allowlast) {
277 struct symbol *argsym;
291 g_hash_table_lookup(probe->
values,(gpointer)(uintptr_t)tid);
309 stack = g_slist_delete_link(stack,stack);
312 stack = g_slist_prepend(stack,pv);
313 g_hash_table_insert(probe->
values,(gpointer)(uintptr_t)tid,stack);
328 if (pv && (allowlast || !pv->
finished)) {
329 if (israw && g_hash_table_lookup(pv->
nr,name))
331 else if (!israw && g_hash_table_lookup(pv->
nv,name))
390 char *name,
int israw,
393 struct value *retval = NULL;
399 struct bsymbol *datatype;
408 g_hash_table_lookup(probe->
values,(gpointer)(uintptr_t)tid);
411 if (pv && (allowlast || !pv->
finished)) {
416 retval = (
struct value *)g_hash_table_lookup(vt,name);
469 return __probe_value_get_function_ee(probe,tid,name,0,0);
474 return __probe_value_get_function_ee(probe,tid,name,1,0);
479 return __probe_value_get_function_ee(probe,tid,name,0,1);
484 return __probe_value_get_function_ee(probe,tid,name,1,1);
487 static struct value *__probe_value_get_basic(
struct probe *probe,
tid_t tid,
488 char *name,
int israw,
490 struct value *retval = NULL;
491 struct symbol *symbol;
492 struct bsymbol *bsymbol;
508 g_hash_table_lookup(probe->
values,(gpointer)(uintptr_t)tid);
509 if (pv && (allowlast || !pv->
finished)) {
514 retval = (
struct value *)g_hash_table_lookup(vt,name);
553 return __probe_value_get_basic(probe,tid,name,0,0);
558 return __probe_value_get_basic(probe,tid,name,1,0);
563 return __probe_value_get_basic(probe,tid,name,0,1);
568 return __probe_value_get_basic(probe,tid,name,1,1);
574 __probe_value_get_basic(probe,tid,NULL,0,0);
576 (gpointer)(uintptr_t)tid);
585 __probe_value_get_basic(probe,tid,NULL,1,0);
587 (gpointer)(uintptr_t)tid);
596 __probe_value_get_basic(probe,tid,NULL,0,1);
598 (gpointer)(uintptr_t)tid);
607 __probe_value_get_basic(probe,tid,NULL,1,1);
609 (gpointer)(uintptr_t)tid);
648 struct bsymbol *bsymbol,
652 #ifdef ENABLE_DISTORM
654 struct bsymbol *bsymbol,
661 struct bsymbol *bsymbol,
665 struct symbol *symbol;
671 pre_handler,post_handler,handler_data);
672 #ifdef ENABLE_DISTORM
674 return probe_value_function_ee(target,tid,bsymbol,
675 pre_handler,post_handler,handler_data);
678 verror(
"can only value probe functions or vars!\n");
683 static const char *probe_value_var_gettype(
struct probe *probe) {
684 return "probe_value_var";
688 .
gettype = probe_value_var_gettype,
702 struct bsymbol *bsymbol,
730 #ifdef ENABLE_DISTORM
731 static const char *probe_value_function_ee_gettype(
struct probe *probe) {
732 return "probe_value_function_entry_exit";
736 .
gettype = probe_value_function_ee_gettype,
750 struct bsymbol *bsymbol,
757 verror(
"must supply a function symbol!\n");
771 if (!probe_register_function_ee(probe,
PROBEPOINT_SW,bsymbol,0,1,1)) {
772 verror(
"could not register entry/exit probes on function %s!\n",
GHashTable * __probe_value_get_table_function_ee(struct probe *probe, tid_t tid, int israw, int allowlast)
struct value * target_load_symbol(struct target *target, struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol, load_flags_t flags)
struct value * probe_value_get_last_function_ee(struct probe *probe, tid_t tid, char *name)
struct value * probe_value_get_last_raw_function_ee(struct probe *probe, tid_t tid, char *name)
result_t pre_handler(struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
struct probe_value * probe_value_create(probe_handler_phase_t phase)
struct probe * probe_value_var(struct target *target, tid_t tid, struct bsymbol *bsymbol, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data)
struct value * target_load_type_reg(struct target *target, struct symbol *type, tid_t tid, REG reg, load_flags_t flags)
struct value * probe_value_get_last_basic(struct probe *probe, tid_t tid, char *name)
struct bsymbol * target_lookup_sym(struct target *target, const char *name, const char *delim, char *srcfile, symbol_type_flag_t ftype)
#define v_g_slist_foreach(gslhead, gslcur, elm)
probe_handler_phase_t phase
void probe_value_notify_phase_function_ee(struct probe *probe, tid_t tid, probe_handler_phase_t phase)
struct target_location_ctxt * target_location_ctxt_create_from_bsymbol(struct target *target, tid_t tid, struct bsymbol *bsymbol)
void probe_values_free_basic(struct probe *probe)
int target_cregno(struct target *target, common_reg_t creg, REG *reg)
#define PROBE_VALUE_NAME_RETURN
result_t probe_do_sink_post_handlers(struct probe *probe, tid_t tid, void *handler_data, struct probe *trigger, struct probe *base)
char * bsymbol_get_name(struct bsymbol *bsymbol)
#define verror(format,...)
result_t probe_do_sink_pre_handlers(struct probe *probe, tid_t tid, void *handler_data, struct probe *trigger, struct probe *base)
const char *(* gettype)(struct probe *probe)
GHashTable * probe_value_get_raw_table_function_ee(struct probe *probe, tid_t tid)
result_t(* probe_handler_t)(struct probe *probe, tid_t tid, void *handler_data, struct probe *trigger, struct probe *base)
GHashTable * probe_value_get_raw_table_basic(struct probe *probe, tid_t tid)
GHashTable * probe_value_get_last_table(struct probe *probe, tid_t tid)
GHashTable * probe_value_get_table(struct probe *probe, tid_t tid)
struct probe * probe_value_symbol(struct target *target, tid_t tid, struct bsymbol *bsymbol, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data)
REFCNT bsymbol_release(struct bsymbol *bsymbol)
int probe_free(struct probe *probe, int force)
void probe_value_free(struct probe_value *pv)
struct value * probe_value_get_function_ee(struct probe *probe, tid_t tid, char *name)
int probe_value_record_stacked(struct probe *probe, tid_t tid, char *name, struct value *value, int israw)
void value_free(struct value *value)
#define PROBE_SAFE_OP_ARGS(probe, op,...)
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 value * probe_value_get_raw(struct probe *probe, tid_t tid, char *name)
int probe_value_record_basic(struct probe *probe, tid_t tid, char *name, struct value *value, int israw)
GHashTable * probe_value_get_last_raw_table(struct probe *probe, tid_t tid)
void * calloc(size_t nmemb, size_t size)
result_t post_handler(struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
GHashTable * probe_value_get_table_function_ee(struct probe *probe, tid_t tid)
struct value * probe_value_get(struct probe *probe, tid_t tid, char *name)
GHashTable * probe_value_get_last_raw_table_function_ee(struct probe *probe, tid_t tid)
struct symbol * bsymbol_get_symbol(struct bsymbol *bsymbol)
GSList * symbol_get_members(struct symbol *symbol, symbol_type_flag_t flags)
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)
GHashTable * probe_value_get_table_basic(struct probe *probe, tid_t tid)
struct value * probe_value_get_raw_basic(struct probe *probe, tid_t tid, char *name)
char * symbol_get_name(struct symbol *symbol)
void probe_value_clear(struct probe_value *pv)
GHashTable * probe_value_get_last_raw_table_basic(struct probe *probe, tid_t tid)
struct probe * probe_register_symbol(struct probe *probe, struct bsymbol *bsymbol, probepoint_style_t style, probepoint_whence_t whence, probepoint_watchsize_t watchsize)
struct value * probe_value_get_last_raw(struct probe *probe, tid_t tid, char *name)
GHashTable * probe_value_get_last_table_function_ee(struct probe *probe, tid_t tid)
void probe_values_free_stacked(struct probe *probe)
#define SYMBOL_IS_FUNC(sym)
uint8_t post_fully_loaded
struct value * probe_value_get_last_raw_basic(struct probe *probe, tid_t tid, char *name)
struct value * probe_value_get_basic(struct probe *probe, tid_t tid, char *name)
GHashTable * probe_value_get_raw_table(struct probe *probe, tid_t tid)
#define SYMBOL_IS_VAR(sym)
void probe_value_notify_phase_watchedvar(struct probe *probe, tid_t tid, probe_handler_phase_t phase)
GHashTable * probe_value_get_last_table_basic(struct probe *probe, tid_t tid)
struct value * probe_value_get_raw_function_ee(struct probe *probe, tid_t tid, char *name)
struct value * probe_value_get_last(struct probe *probe, tid_t tid, char *name)