24 #include <sys/ptrace.h>
48 {
"post",
'P',0,0,
"Enable post handlers.",0 },
49 {
"quiet",
'q',0,0,
"Silent but deadly.",0 },
60 struct probe *trigger,
struct probe *base) {
85 vwarn(
"probe %s: could not get values from probe %s"
99 g_hash_table_iter_init(&iter,vt);
100 while (g_hash_table_iter_next(&iter,&kp,&vp)) {
105 v = (
struct value *)vp;
109 fprintf(stdout,
"%s = %s",(
char *)kp,vstrbuf);
111 fprintf(stdout,
"%s = ?",(
char *)kp);
114 fprintf(stdout,
"%s = ?",(
char *)kp);
122 fprintf(stdout,
" = ?");
132 v = (
struct value *) \
137 fprintf(stdout,
" = %s",vstrbuf);
139 fprintf(stdout,
" = ?");
149 fprintf(stdout,
"tid=%"PRIiTID"",tid);
151 fprintf(stdout,
"%s",buf);
157 fprintf(stdout,
" backtrace=[error!]");
159 fprintf(stdout,
" backtrace=[empty]");
161 fprintf(stdout,
" backtrace=[%s]",buf);
184 return ARGP_ERR_UNKNOWN;
187 if (state->quoted > 0)
188 opts->
argc = state->quoted - state->next;
190 opts->
argc = state->argc - state->next;
191 if (opts->
argc > 0) {
193 memcpy(opts->
argv,&state->argv[state->next],opts->
argc*
sizeof(
char *));
194 state->next += opts->
argc;
201 case ARGP_KEY_NO_ARGS:
202 case ARGP_KEY_SUCCESS:
216 return ARGP_ERR_UNKNOWN;
226 GList *base_target_specs = NULL;
227 GList *overlay_target_specs = NULL;
243 &primary_target_spec,&base_target_specs,
244 &overlay_target_specs);
247 verror(
"could not parse target arguments!\n");
256 base_target_specs,overlay_target_specs,
259 verror(
"could not instantiate and open targets!\n");
269 rname = index(name,
':');
276 "Could not lookup target %s for symbol %s; aborting!\n",
295 fprintf(stderr,
"could not lookup symbol %s; aborting!\n",name);
311 fprintf(stderr,
"could not place value probe on %s; aborting!\n",
332 fprintf(stdout,
"Starting main debugging loop!\n");
348 fprintf(stderr,
"error in target_monitor_evloop (%d): %s;"
349 " attempting to continue!\n",rc,strerror(errno));
362 "Error handling target '%s'; closing and finalizing!\n",
367 targets = g_list_remove(targets,t);
371 "Target '%s' finished; finalizing!\n",
376 targets = g_list_remove(targets,t);
379 fprintf(stderr,
"Target '%s' exiting...\n",tname);
382 fprintf(stderr,
"Target '%s' interrupted, resuming...\n",tname);
384 fprintf(stderr,
"Could not resume target %s tid %"PRIiTID"\n",
389 targets = g_list_remove(targets,t);
394 "Target '%s' tid %d received unexpected status '%s'"
395 " at 0x%"PRIxADDR"; attempting to continue!\n",
398 fprintf(stderr,
"Could not resume target %s tid %"PRIiTID"\n",
403 targets = g_list_remove(targets,t);
409 printf(
"Monitoring completed; exiting!\n");
int target_thread_snprintf(struct target *target, tid_t tid, char *buf, int bufsiz, int detail, char *sep, char *kvsep)
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)
int value_snprintf(struct value *value, char *buf, int buflen)
void * target_argp_driver_state(struct argp_state *state)
int target_unwind_snprintf(char *buf, int buflen, struct target *target, tid_t tid, target_unwind_style_t fstyle, char *frame_sep, char *ksep)
struct bsymbol * probe_symbol(struct probe *probe)
result_t handler(struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
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 target_monitor_evloop(struct evloop *evloop, struct timeval *timeout, struct target **target, target_status_t *status)
int target_resume(struct target *target)
#define v_g_list_foreach(glhead, glcur, elm)
#define PROBE_VALUE_NAME_RETURN
tid_t target_gettid(struct target *target)
error_t dt_argp_parse_opt(int key, char *arg, struct argp_state *state)
GHashTable * probe_value_get_table(struct probe *probe, tid_t tid)
int target_close(struct target *target)
#define verror(format,...)
int target_install_default_sighandlers(void(*sighandler)(int signo, siginfo_t *siginfo, void *x))
#define vwarn(format,...)
REGVAL target_read_reg(struct target *target, tid_t tid, REG reg)
int main(int argc, char **argv)
void target_default_cleanup()
REFCNT bsymbol_release(struct bsymbol *bsymbol)
int target_argp_driver_parse(struct argp *driver_parser, void *driver_state, int argc, char **argv, target_type_t target_types, int filter_quoted, struct target_spec **primary_target_spec, GList **base_target_specs, GList **overlay_target_specs)
int target_monitor_was_interrupted(siginfo_t *last_siginfo)
struct dt_argp_state opts
int symbol_type_flags_match(struct symbol *symbol, symbol_type_flag_t flags)
char * target_name(struct target *target)
struct target * probe_target(struct probe *probe)
int evloop_maxsize(struct evloop *evloop)
void * calloc(size_t nmemb, size_t size)
struct evloop * evloop_create(evloop_error_handler_t ehandler)
struct target * target_lookup_target_id(int id)
int target_finalize(struct target *target)
struct symbol * bsymbol_get_symbol(struct bsymbol *bsymbol)
GList * target_instantiate_and_open(struct target_spec *primary_target_spec, GList *base_target_specs, GList *overlay_target_specs, struct evloop *evloop, GList **error_specs)
struct argp_option dt_argp_opts[]
char * symbol_get_name(struct symbol *symbol)
char * probe_name(struct probe *probe)
void target_driver_argp_init_children(struct argp_state *state)