42 #define LF_U_CFG   1 << 1 
   43 #define LF_U_PROBE 1 << 2 
  188     g_hash_table_iter_init(&iter,
fprobes);
 
  189     while (g_hash_table_iter_next(&iter,
 
  199     g_hash_table_iter_init(&iter,
sprobes);
 
  200     while (g_hash_table_iter_next(&iter,
 
  214     if (sigismember(&
exitset,signo)) {
 
  220               int ttctx,
int ttdetail,
int bt,
int overlay_levels,
 
  221               char *overlay_debuginfo_prefix,
char *sep,
char *kvsep,
 
  222               char *tprefix,
char *tsep) {
 
  230     struct target *overlay;
 
  236     else if (ttctx == 1) {
 
  237     tids = array_list_create(1);
 
  238     array_list_append(tids,(
void *)(uintptr_t)tid);
 
  240     else if (ttctx == 2) {
 
  241     tids = array_list_create(8);
 
  248         array_list_append(tids,(
void *)(uintptr_t)ttid);
 
  249         ttid = tthread->
ptid;
 
  252     else if (ttctx == 3) {
 
  256         tids = array_list_create(1);
 
  257     array_list_prepend(tids,(
void *)(uintptr_t)tid);
 
  267     if (tthread->
tid == tid && didmaintid)
 
  269     else if (tthread->
tid == tid)
 
  272     fprintf(stream,
"%s",tsep);
 
  275                    ttdetail,sep,kvsep) < 0) 
 
  276         fprintf(stream,
"%s[tid=%"PRIiTID"",tprefix,tthread->
tid);
 
  278         fprintf(stream,
"%s[%s",tprefix,buf);
 
  284         fprintf(stream,
"%sbacktrace=[error!]",sep);
 
  286         fprintf(stream,
"%sbacktrace=[empty]",sep);
 
  288         fprintf(stream,
"%sbacktrace=[%s]",sep,buf);
 
  296     otl = array_list_create(8);
 
  299     while (overlay_levels != 0) {
 
  304         if (overlay_debuginfo_prefix)
 
  313         fprintf(stream,
"%s",tsep);
 
  316                        ttdetail,sep,kvsep) < 0) 
 
  317         fprintf(stream,
"%s[overlay=%s%stid=%"PRIiTID"",
 
  318             tprefix,overlay->
name,sep,ttid);
 
  320         fprintf(stream,
"%s[overlay=%s%s%s",
 
  321             tprefix,overlay->
name,sep,buf);
 
  328             fprintf(stream,
"%sbacktrace=[error!]",sep);
 
  330             fprintf(stream,
"%sbacktrace=[empty]",sep);
 
  332             fprintf(stream,
"%sbacktrace=[%s]",sep,buf);
 
  339         array_list_prepend(otl,overlay);
 
  347     array_list_free(otl);
 
  351     array_list_free(tids);
 
  355            int overlay_levels,
char *overlay_debuginfo_prefix) {
 
  369     stid = (int)strtol(tiddesc,&endptr,10);
 
  370     if (tiddesc == endptr) 
 
  386     if (stid == -1 && !tiddesc) {
 
  387     tids = array_list_create(1);
 
  388     array_list_append(tids,(
void *)(uintptr_t)ctid);
 
  390     printf(
"Backtracing target '%s' (current thread %d):\n\n",t->
name,ctid);
 
  393     tids = array_list_create(1);
 
  394     array_list_append(tids,(
void *)(uintptr_t)stid);
 
  396     printf(
"Backtracing target '%s' (thread %d):\n\n",t->
name,stid);
 
  401     printf(
"Backtracing target '%s' (thread name %s):\n\n",t->
name,tiddesc);
 
  406     printf(
"Backtracing target '%s' (all threads):\n\n",t->
name);
 
  414     if ((tiddesc && !tthread->
name)
 
  415         || (tiddesc && strcmp(tiddesc,tthread->
name)))
 
  421         fprintf(stdout,
"\ntarget %s thread %"PRIiTID": (error!)\n",
 
  424         fprintf(stdout,
"\ntarget %s thread %"PRIiTID": (nothing)\n",
 
  427         fprintf(stdout,
"\ntarget %s thread %"PRIiTID": \n%s\n",
 
  430     if (overlay_levels == 0)
 
  436     otl = array_list_create(8);
 
  438     while (overlay_levels != 0) {
 
  446         if (overlay_debuginfo_prefix)
 
  458         fprintf(stdout,
"\ntarget %s thread %"PRIiTID": (error!)\n",
 
  461         fprintf(stdout,
"\ntarget %s thread %"PRIiTID": (nothing)\n",
 
  464         fprintf(stdout,
"\ntarget %s thread %"PRIiTID": \n%s\n",
 
  465             overlay->
name,tid,buf);
 
  469         array_list_prepend(otl,overlay);
 
  477     array_list_free(otl);
 
  498     stid = (int)strtol(tiddesc,&endptr,10);
 
  499     if (tiddesc == endptr) 
 
  515     if (stid == -1 && !tiddesc) {
 
  516     tids = array_list_create(1);
 
  517     array_list_append(tids,(
void *)(uintptr_t)ctid);
 
  519     printf(
"Signaling target '%s' (current thread %d):\n\n",t->
name,ctid);
 
  522     tids = array_list_create(1);
 
  523     array_list_append(tids,(
void *)(uintptr_t)stid);
 
  525     printf(
"Signaling target '%s' (thread %d):\n\n",t->
name,stid);
 
  530     printf(
"Signaling target '%s' (thread name %s):\n\n",t->
name,tiddesc);
 
  535     printf(
"Signaling target '%s' (all threads):\n\n",t->
name);
 
  543     if ((tiddesc && !tthread->
name)
 
  544         || (tiddesc && strcmp(tiddesc,tthread->
name)))
 
  549         fprintf(stdout,
"thread %"PRIiTID": (error!)\n",tid);
 
  551         fprintf(stdout,
"thread %"PRIiTID": success\n",tid);
 
  553         fprintf(stdout,
"thread %"PRIiTID": unknown status %d\n",tid,rc);
 
  562          struct probe *trigger,
struct probe *base) {
 
  565     char vstrbuf_static[1024];
 
  566     char *vstrbuf = NULL;
 
  567     char *vstrbuf_dynamic = NULL;
 
  568     int vstrbuf_dynamic_size = 0;
 
  578     struct probe *fprobe;
 
  592         verror(
"probe %s: could not create action on probe %s !\n",
 
  596         verror(
"probe %s: could not schedule action on probe %s!\n",
 
  602                "probe %s: scheduled return action on probe %s\n",
 
  612         fprobe = (
struct probe *)               \
 
  615         vwarn(
"probe %s: cannot enable nonexisting filter probe %s!\n",
 
  621                "probe %s: enabled filter probe %s\n",
 
  630         fprobe = (
struct probe *) \
 
  633         vwarn(
"probe %s: cannot enable nonexisting filter probe %s!\n",
 
  650         fprobe = (
struct probe *) \
 
  653             vwarn(
"probe %s: cannot remove nonexisting filter probe %s!\n",
 
  667         if (spfa->
exit.retval == -69) {
 
  691         vwarn(
"probe %s: could not get values from probe %s" 
  699         fprintf(stdout,
"RESULT:: (%c:%d) %s (%d) %s %s (",
 
  707         g_hash_table_iter_init(&iter,vt);
 
  708         while (g_hash_table_iter_next(&iter,&kp,&vp)) {
 
  711             v = (
struct value *)vp;
 
  714                         sizeof(vstrbuf_static));
 
  715             vstrbuf = vstrbuf_static;
 
  716             if (rc >= (
int)
sizeof(vstrbuf_static)) {
 
  717                 vstrbuf_dynamic_size = rc + 1;
 
  718                 vstrbuf_dynamic = 
malloc(vstrbuf_dynamic_size);
 
  720                         vstrbuf_dynamic_size);
 
  721                 vstrbuf = vstrbuf_dynamic;
 
  726                 for (j = 0; vstrbuf[j] != 
'\0'; ++j) {
 
  727                 if (!isgraph(vstrbuf[j]) && !isspace(vstrbuf[j])) {
 
  734                 vwarn(
"unprintable raw value for key %s = 0x",
 
  736                 for (j = 0; vstrbuf[j] != 
'\0'; ++j) {
 
  737                     vwarnc(
"%hhx",vstrbuf[j]);
 
  741                 fprintf(stdout,
"%s=??",(
char *)kp);
 
  744                 fprintf(stdout,
"%s=%s",(
char *)kp,vstrbuf);
 
  748                 fprintf(stdout,
"%s=?",(
char *)kp);
 
  750             if (vstrbuf_dynamic) {
 
  751                 free(vstrbuf_dynamic);
 
  752                 vstrbuf_dynamic = NULL;
 
  753                 vstrbuf_dynamic_size = 0;
 
  757             fprintf(stdout,
"%s=?",(
char *)kp);
 
  765                  spfa->
report.overlay_debuginfo_prefix,
 
  766                  ";",
":",
"thread=",
",");
 
  767         fprintf(stdout,
") ::RESULT\n");
 
  776         vwarn(
"probe %s: could not get values from probe %s" 
  788         g_hash_table_iter_init(&iter,vt);
 
  789         while (g_hash_table_iter_next(&iter,&kp,&vp)) {
 
  794             v = (
struct value *)vp;
 
  797                         sizeof(vstrbuf_static));
 
  798             vstrbuf = vstrbuf_static;
 
  799             if (rc >= (
int)
sizeof(vstrbuf_static)) {
 
  800                 vstrbuf_dynamic_size = rc + 1;
 
  801                 vstrbuf_dynamic = 
malloc(vstrbuf_dynamic_size);
 
  803                         vstrbuf_dynamic_size);
 
  804                 vstrbuf = vstrbuf_dynamic;
 
  808                 fprintf(stdout,
"%s = %s",(
char *)kp,vstrbuf);
 
  810                 fprintf(stdout,
"%s = ?",(
char *)kp);
 
  812             if (vstrbuf_dynamic) {
 
  813                 free(vstrbuf_dynamic);
 
  814                 vstrbuf_dynamic = NULL;
 
  815                 vstrbuf_dynamic_size = 0;
 
  819             fprintf(stdout,
"%s = ?",(
char *)kp);
 
  827             fprintf(stdout,
" = ?");
 
  832             v = (
struct value *) \
 
  836                         sizeof(vstrbuf_static));
 
  837             vstrbuf = vstrbuf_static;
 
  838             if (rc >= (
int)
sizeof(vstrbuf_static)) {
 
  839                 vstrbuf_dynamic_size = rc + 1;
 
  840                 vstrbuf_dynamic = 
malloc(vstrbuf_dynamic_size);
 
  842                         vstrbuf_dynamic_size);
 
  843                 vstrbuf = vstrbuf_dynamic;
 
  847                 fprintf(stdout,
" = %s",vstrbuf_static);
 
  849                 fprintf(stdout,
" = ?");
 
  851             if (vstrbuf_dynamic) {
 
  852                 free(vstrbuf_dynamic);
 
  853                 vstrbuf_dynamic = NULL;
 
  854                 vstrbuf_dynamic_size = 0;
 
  862                  0,0,NULL,NULL,NULL,
"",
",");
 
  867         if (spfa->
bt.tid > 1) {
 
  870             verror(
"no existing target with id '%d'!\n",spfa->
bt.tid);
 
  878               spfa->
bt.overlay_debuginfo_prefix);
 
  881         if (spfa->
signal.tid > 1) {
 
  884             verror(
"no existing target with id '%d'!\n",
 
  895         verror(
"probe %s: bad action type %d -- BUG!\n",
 
  904              struct probe *trigger,
struct probe *base) {
 
  909               struct probe *trigger,
struct probe *base) {
 
  919               struct probe *trigger,
struct probe *base) {
 
  924 #define __TARGET_OVERLAY      0x200000 
  925 #define SPF_CONFIGFILE_FATAL  0x200001 
  926 #define SPF_OS_SYSCALL_PROBES 0x200002 
  929     { 
"overlay",
__TARGET_OVERLAY,
"[<target_id>:]<thread_name_or_id>:<spec_opts>",0,
"Lookup name or id as an overlay target once the main target is instantiated, and try to open it.  All dumptarget options then apply to the overlay.",0 },
 
  930     { 
"config-file",
'C',
"<FILE>",0,
"An SPF config file.",0 },
 
  932       "Make errors while applying runtime updates (via USR2) to the config file fatal.",0 },
 
  934       "Try to use target_os_syscall probes if symbol is a syscall and target is an OS.",0 },
 
  944     return ARGP_ERR_UNKNOWN;
 
  947     if (state->quoted > 0)
 
  948         opts->
argc = state->quoted - state->next;
 
  950         opts->
argc = state->argc - state->next;
 
  951     if (opts->
argc > 0) {
 
  953         memcpy(opts->
argv,&state->argv[state->next],opts->
argc*
sizeof(
char *));
 
  954         state->next += opts->
argc;
 
  961     case ARGP_KEY_NO_ARGS:
 
  962     case ARGP_KEY_SUCCESS:
 
  978     return ARGP_ERR_UNKNOWN;
 
  988 int main(
int argc,
char **argv) {
 
  991     struct probe *sprobe, *fprobe;
 
  992     char *
name, *context;
 
  996     char *pre_filter, *post_filter;
 
 1000     GList *base_target_specs = NULL;
 
 1001     GList *overlay_target_specs = NULL;
 
 1042                   &primary_target_spec,&base_target_specs,
 
 1043                   &overlay_target_specs);
 
 1046     verror(
"could not parse target arguments!\n");
 
 1061                       base_target_specs,overlay_target_specs,
 
 1064     verror(
"could not instantiate and open targets!\n");
 
 1071     sprobes = g_hash_table_new(g_direct_hash,g_direct_equal);
 
 1072     fprobes = g_hash_table_new(g_direct_hash,g_direct_equal);
 
 1080         vwarn(
"could not load the syscall table for target %s;" 
 1081               " target_os_syscall probes will not be available!\n",
 
 1088         pre_filter = post_filter = context = NULL;
 
 1090         while (*str != 
'\0') {
 
 1091         if (*str == 
':' && *(str+1) == 
':') {
 
 1104         while (*str != 
'\0') {
 
 1105         if (*str == 
':' && *(str+1) == 
':') {
 
 1118         while (*str != 
'\0') {
 
 1119         if (*str == 
':' && *(str+1) == 
':') {
 
 1129         sprobe = (
struct probe *)g_hash_table_lookup(
sprobes,name);
 
 1149                 verror(
"could not place syscall value probe on %s;" 
 1150                    " aborting!\n",name);
 
 1170                 verror(
"could not place value probe on %s;" 
 1171                    " aborting!\n",name);
 
 1181             verror(
"could not probe symbol %s; aborting!\n",name);
 
 1186             g_hash_table_insert(
sprobes,name,sprobe);
 
 1193             verror(
"could not parse pre_filter '%s'!\n",pre_filter);
 
 1203             verror(
"could not parse post_filter '%s'!\n",post_filter);
 
 1211         snprintf(namebuf,
sizeof(namebuf),
"filter_%s_%d",name,i);
 
 1218         g_hash_table_insert(
fprobes,namebuf,fprobe);
 
 1223     if (access(
"spf.conf",R_OK)) {
 
 1224         verror(
"Must supply some symbols to probe!\n");
 
 1233         verror(
"could not read default config file %s!\n",
 
 1251     if (g_hash_table_size(
sprobes) == 0) {
 
 1252     verror(
"No symbols to probe; exiting!\n");
 
 1265     fprintf(stdout,
"Starting Symbol Probe Filtering!\n");
 
 1268     fprintf(stdout,
"Starting thread watch loop!\n");
 
 1289         else if (siginfo.si_signo == SIGUSR1
 
 1290              || siginfo.si_signo == SIGUSR2
 
 1291              || siginfo.si_signo == SIGHUP) {
 
 1303         fprintf(stderr,
"error in target_monitor_evloop (%d): %s; aborting!\n",
 
 1304             rc,strerror(errno));
 
 1318             "Error handling target '%s'; closing and finalizing!\n",
 
 1327             "Target '%s' finished; finalizing!\n",
 
 1335         fprintf(stderr,
"Target '%s' exiting...\n",tname);
 
 1338         fprintf(stderr,
"Target '%s' interrupted, resuming...\n",tname);
 
 1340             fprintf(stderr,
"Could not resume target %s tid %"PRIiTID"\n",
 
 1350             "Target '%s' tid %d received unexpected status '%s'" 
 1351             " at 0x%"PRIxADDR"; attempting to continue!\n",
 
 1354             fprintf(stderr,
"Could not resume target %s tid %"PRIiTID"\n",
 
 1456     while (*s != 
'\0') {
 
 1464         else if (*s == encchar && !wasesc) {
 
 1473     else if (*s == 
'\\') {
 
 1499         vwarn(
"could not reread config file %s; leaving" 
 1529     GHashTable *needed = NULL;
 
 1530     GHashTableIter iter;
 
 1540     g_hash_table_iter_init(&iter,
fprobes);
 
 1541     while (g_hash_table_iter_next(&iter,&kp,&vp)) {
 
 1542     probe = (
struct probe *)vp;
 
 1544     g_hash_table_iter_remove(&iter);
 
 1548     needed = g_hash_table_new(g_str_hash,g_str_equal);
 
 1550     g_hash_table_insert(needed,spff->
symbol,NULL);
 
 1570         verror(
"could not lookup symbol %s; aborting!\n",
 
 1577         vwarn(
"could not lookup symbol %s; skipping filter!\n",
 
 1597                 verror(
"could not place syscall value probe on %s;" 
 1605                 vwarn(
"could not place syscall value probe on %s;" 
 1606                   " skipping filter!\n",
 
 1622             verror(
"could not place value probe on %s; aborting!\n",
 
 1629             vwarn(
"could not place value probe on %s; skipping filter!\n",
 
 1640     g_hash_table_iter_init(&iter,
sprobes);
 
 1641     while (g_hash_table_iter_next(&iter,&kp,&vp)) {
 
 1642     if (g_hash_table_lookup_extended(needed,kp,NULL,NULL) == FALSE) {
 
 1644         g_hash_table_iter_remove(&iter);
 
 1647     g_hash_table_destroy(needed);
 
 1653     sprobe = (
struct probe *)g_hash_table_lookup(
sprobes,spff->
symbol);
 
 1657         snprintf(namebuf,
sizeof(namebuf),
"filter_%s_%d",spff->
symbol,i);
 
 1658         spff->
id = strdup(namebuf);
 
 1663                        spff->
ttf,spff,0,1);
 
 1667                        spff->
ttf,spff,0,1);
 
 1673     g_hash_table_insert(
fprobes,spff->
id,fprobe);
 
 1692     char *token = NULL, *token2 = NULL;
 
 1700     if (strcmp(file,
"-") == 0)
 
 1703     ffile = fopen(file,
"r");
 
 1705         verror(
"could not fopen config file %s: %s\n",file,strerror(errno));
 
 1710     retval = 
calloc(1,
sizeof(*retval));
 
 1718         tbuf = fgets(buf + rc,bufsiz - rc,ffile);
 
 1719         if (tbuf && (rc += strlen(buf + rc)) == (bufsiz - 1) 
 
 1720         && buf[bufsiz - 2] != 
'\n') {
 
 1722         tbuf = 
malloc(bufsiz + 128);
 
 1723         memcpy(tbuf,buf,bufsiz);
 
 1728         else if (tbuf && rc < bufsiz) {
 
 1733         verror(
"fgets: %s (aborting filter file read)\n",
 
 1754     if (buf[strlen(buf) - 1] == 
'\n') {
 
 1757         buf[strlen(buf) - 1] = 
'\0';
 
 1763     if (strncmp(buf,
"ProbeFilter",strlen(
"ProbeFilter")) == 0) {
 
 1764         bufptr = buf + strlen(
"ProbeFilter");
 
 1765         while (isspace(*bufptr)) ++bufptr;
 
 1780         while (!isspace(*bufptr)) ++bufptr;
 
 1782         spff->
symbol = strdup(token);
 
 1783         if ((tmp = index(spff->
symbol,
':'))) {
 
 1786         spff->
symbol = strdup(tmp+1);
 
 1791         while (*bufptr != 
'\0') {
 
 1792         while (isspace(*bufptr)) ++bufptr;
 
 1793         if (*bufptr == 
'\0')
 
 1797         while (isalnum(*bufptr) || *bufptr == 
'_') ++bufptr;
 
 1798         if (*bufptr == 
'(') {
 
 1805             while (isspace(*bufptr)) ++bufptr;
 
 1811         if (strcmp(token,
"id") == 0) {
 
 1813             while (isalnum(*bufptr) || *bufptr == 
'_') ++bufptr;
 
 1821             spff->
id = strdup(token);
 
 1823         else if (strcmp(token,
"when") == 0) {
 
 1824             if (strncmp(bufptr,
"pre",strlen(
"pre")) == 0) {
 
 1826             bufptr += strlen(
"pre");
 
 1828             else if (strncmp(bufptr,
"post",strlen(
"post")) == 0) {
 
 1830             bufptr += strlen(
"post");
 
 1838         else if (strcmp(token,
"disable") == 0) {
 
 1845         else if (strcmp(token,
"vfilter") == 0) {
 
 1851             char *nextbufptr = NULL;
 
 1852             while (*bufptr != 
'\0') {
 
 1853             if (*bufptr == 
'\\') {
 
 1859             else if (*bufptr == 
')' && !isescaped) {
 
 1860                 nextbufptr = bufptr + 1;
 
 1871             bufptr = nextbufptr;
 
 1873         else if (strcmp(token,
"tfilter") == 0) {
 
 1879             char *nextbufptr = NULL;
 
 1880             while (*bufptr != 
'\0') {
 
 1881             if (*bufptr == 
'\\') {
 
 1887             else if (*bufptr == 
')' && !isescaped) {
 
 1888                 nextbufptr = bufptr + 1;
 
 1899             bufptr = nextbufptr;
 
 1901         else if (strcmp(token,
"abort") == 0) {
 
 1903             while (*bufptr == 
'-' || isdigit(*bufptr)) ++bufptr;
 
 1909             numval = strtol(token,NULL,0);
 
 1913             spfa = 
calloc(1,
sizeof(*spfa));
 
 1915             spfa->
abort.retval = numval;
 
 1920         else if (strcmp(token,
"print") == 0) {
 
 1921             spfa = 
calloc(1,
sizeof(*spfa));
 
 1924             if (*bufptr == 
')') {
 
 1933             char *nextbufptr = NULL;
 
 1942             while ((token = strtok_r((!token) ? bufptr : NULL,
",",
 
 1945                 while (*tptr != 
'\0') {
 
 1956                 if (strcmp(token,
"ttctx") == 0) {
 
 1957                 if (strcmp(token2,
"none") == 0)
 
 1958                     spfa->
print.ttctx = 0;
 
 1959                 else if (strcmp(token2,
"self") == 0)
 
 1960                     spfa->
print.ttctx = 1;
 
 1961                 else if (strcmp(token2,
"hier") == 0)
 
 1962                     spfa->
print.ttctx = 2;
 
 1963                 else if (strcmp(token2,
"all") == 0)
 
 1964                     spfa->
print.ttctx = 3;
 
 1968                 else if (strcmp(token,
"ttdetail") == 0) {
 
 1969                 spfa->
print.ttdetail = atoi(token2);
 
 1974             bufptr = nextbufptr;
 
 1980         else if (strcmp(token,
"report") == 0) {
 
 1981             spfa = 
calloc(1,
sizeof(*spfa));
 
 1986             spfa->
report.overlay_levels = 0;
 
 1987             spfa->
report.overlay_debuginfo_prefix = NULL;
 
 1994             char *nextbufptr = NULL;
 
 2003             while ((token = strtok_r((!token) ? bufptr : NULL,
",",
 
 2006             while (*tptr != 
'\0') {
 
 2017             if (strcmp(token,
"rt") == 0) {
 
 2019                 spfa->
report.rt = *token2;
 
 2020                 else if (*token2 == 
'i')
 
 2021                 spfa->
report.rt = *token2;
 
 2025             else if (strcmp(token,
"tn") == 0) {
 
 2026                 spfa->
report.tn = strdup(token2);
 
 2028             else if (strcmp(token,
"tid") == 0) {
 
 2030                 spfa->
report.tid = strtol(token2,NULL,0);
 
 2034             else if (strcmp(token,
"rv") == 0) {
 
 2035                 spfa->
report.rv = strdup(token2);
 
 2037             else if (strcmp(token,
"msg") == 0) {
 
 2038                 if (*token2 != 
'"') {
 
 2040                 snprintf(spfa->
report.msg,2+1+strlen(token2),
 
 2044                 spfa->
report.msg = strdup(token2);
 
 2046             else if (strcmp(token,
"ttctx") == 0) {
 
 2047                 if (strcmp(token2,
"none") == 0)
 
 2049                 else if (strcmp(token2,
"self") == 0)
 
 2051                 else if (strcmp(token2,
"hier") == 0)
 
 2053                 else if (strcmp(token2,
"all") == 0)
 
 2058             else if (strcmp(token,
"ttdetail") == 0) {
 
 2059                 spfa->
report.ttdetail = atoi(token2);
 
 2061             else if (strcmp(token,
"bt") == 0) {
 
 2062                 spfa->
report.bt = atoi(token2);
 
 2064             else if (strcmp(token,
"overlay_levels") == 0) {
 
 2065                 spfa->
report.overlay_levels = atoi(token2);
 
 2067             else if (strcmp(token,
"overlay_debuginfo_root_prefix") == 0) {
 
 2068                 spfa->
report.overlay_debuginfo_prefix =
 
 2074             bufptr = nextbufptr;
 
 2079         else if (strcmp(token,
"exit") == 0) {
 
 2081             while (*bufptr == 
'-' || isdigit(*bufptr)) ++bufptr;
 
 2087             numval = strtol(token,NULL,0);
 
 2091             spfa = 
calloc(1,
sizeof(*spfa));
 
 2093             spfa->
exit.retval = numval;
 
 2098         else if (strcmp(token,
"enable") == 0) {
 
 2100             while (isalnum(*bufptr) || *bufptr == 
'_') ++bufptr;
 
 2105             spfa = 
calloc(1,
sizeof(*spfa));
 
 2107             spfa->
enable.id = strdup(token);
 
 2112         else if (strcmp(token,
"disable") == 0) {
 
 2114             while (isalnum(*bufptr) || *bufptr == 
'_') ++bufptr;
 
 2119             spfa = 
calloc(1,
sizeof(*spfa));
 
 2121             spfa->
disable.id = strdup(token);
 
 2126         else if (strcmp(token,
"remove") == 0) {
 
 2128             while (isalnum(*bufptr) || *bufptr == 
'_') ++bufptr;
 
 2133             spfa = 
calloc(1,
sizeof(*spfa));
 
 2135             spfa->
remove.id = strdup(token);
 
 2140         else if (strcmp(token,
"bt") == 0) {
 
 2141             spfa = 
calloc(1,
sizeof(*spfa));
 
 2146             spfa->
bt.thid = NULL;
 
 2147             spfa->
bt.overlay_levels = 0;
 
 2148             spfa->
bt.overlay_debuginfo_prefix = NULL;
 
 2150             char *nextbufptr = NULL;
 
 2161             while ((token = strtok_r((!token) ? bufptr : NULL,
",",
 
 2164                 spfa->
bt.tid = atoi(token);
 
 2166                 spfa->
bt.thid = strdup(token);
 
 2168                 spfa->
bt.overlay_levels = atoi(token);
 
 2170                 spfa->
bt.overlay_debuginfo_prefix = strdup(token);
 
 2176             bufptr = nextbufptr;
 
 2181         else if (strcmp(token,
"signal") == 0) {
 
 2182             spfa = 
calloc(1,
sizeof(*spfa));
 
 2187             spfa->
signal.thid = NULL;
 
 2189             char *nextbufptr = NULL;
 
 2200             while ((token = strtok_r((!token) ? bufptr : NULL,
",",
 
 2203                 spfa->
signal.tid = atoi(token);
 
 2205                 spfa->
signal.thid = strdup(token);
 
 2207                 spfa->
signal.sigdesc = strdup(token);
 
 2213             bufptr = nextbufptr;
 
 2231         fprintf(stderr,
"ERROR: unknown config directive line %d:\n",lineno);
 
 2232         fprintf(stderr,
"%s\n", buf);
 
 2247     verror(
"parse error at line %d col %d: '%.48s ...'\n",
 
 2248        lineno,(
int)(bufptr - buf),bufptr);
 
struct target * target_instantiate_overlay(struct target *target, tid_t tid, struct target_spec *spec)
int target_thread_snprintf(struct target *target, tid_t tid, char *buf, int bufsiz, int detail, char *sep, char *kvsep)
void print_thread_context(FILE *stream, struct target *target, tid_t tid, int ttctx, int ttdetail, int bt, int overlay_levels, char *overlay_debuginfo_prefix, char *sep, char *kvsep, char *tprefix, char *tsep)
struct action * action_return(REGVAL retval)
result_t pre_handler(struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
void spf_backtrace(struct target *t, tid_t ctid, char *tiddesc, int overlay_levels, char *overlay_debuginfo_prefix)
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 probe_unregister(struct probe *probe, int force)
void reload_config_file(void)
void target_monitor_schedule_global_interrupt(void)
int value_snprintf(struct value *value, char *buf, int buflen)
int use_os_syscall_probes
target_personality_t personality
void * target_argp_driver_state(struct argp_state *state)
struct target_nv_filter * ttf
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 spf_config * load_config_file(char *file)
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)
REFCNT action_release(struct action *action)
result_t handler(int when, struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
#define v_g_slist_foreach(gslhead, gslcur, elm)
int target_resume(struct target *target)
struct overlay_spec ** ospecs
#define v_g_list_foreach(glhead, glcur, elm)
result_t null_handler(struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
int target_pause(struct target *target)
#define PROBE_VALUE_NAME_RETURN
tid_t target_gettid(struct target *target)
struct argp_option spf_argp_opts[]
struct probe * probe_create_filtered(struct target *target, tid_t tid, struct probe_ops *pops, const char *name, probe_handler_t pre_handler, struct target_nv_filter *pre_filter, probe_handler_t post_handler, struct target_nv_filter *post_filter, struct target_nv_filter *thread_filter, void *handler_data, int autofree, int tracked)
GHashTable * probe_value_get_table(struct probe *probe, tid_t tid)
result_t probe_do_sink_post_handlers(struct probe *probe, tid_t tid, void *handler_data, struct probe *trigger, struct probe *base)
struct spf_action::@30::@38 remove
struct target_os_syscall * target_os_syscall_lookup_name(struct target *target, char *name)
int target_close(struct target *target)
struct spf_action::@30::@32 report
#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)
int target_install_custom_sighandlers(sigset_t *ignored, sigset_t *interrupt, sigset_t *exit, void(*sighandler)(int signo, siginfo_t *siginfo, void *x))
char * _get_next_non_enc_esc(char *s, int c)
struct spf_action::@30::@33 print
#define vwarn(format,...)
REGVAL target_read_reg(struct target *target, tid_t tid, REG reg)
void spf_filter_free(struct spf_filter *spff)
struct spf_argp_state opts
struct spf_action::@30::@36 enable
struct probe * probe_register_source(struct probe *sink, struct probe *src)
error_t spf_argp_parse_opt(int key, char *arg, struct argp_state *state)
struct target_nv_filter * pf
#define array_list_foreach(alist, lpc, placeholder)
void target_monitor_clear_global_interrupt(void)
void spf_config_free(struct spf_config *config)
void target_default_cleanup()
struct spf_action::@30::@35 exit
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 array_list * target_list_tids(struct target *target)
int target_os_syscall_table_load(struct target *target)
struct probe * target_os_syscall_probe(struct target *target, tid_t tid, struct target_os_syscall *syscall, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data)
int probe_free(struct probe *probe, int force)
int symbol_type_flags_match(struct symbol *symbol, symbol_type_flag_t flags)
struct target_spec * target_build_default_overlay_spec(struct target *target, tid_t tid)
char * target_name(struct target *target)
struct spf_action::@30::@37 disable
int probe_enable(struct probe *probe)
#define SPF_CONFIGFILE_FATAL
struct spf_action::@30::@34 abort
#define vdebug(devel, areas, flags, format,...)
#define SPF_OS_SYSCALL_PROBES
int apply_config_file(struct spf_config *config)
struct array_list * target_list_available_tids(struct target *target)
int evloop_maxsize(struct evloop *evloop)
void * calloc(size_t nmemb, size_t size)
struct target_nv_filter * target_nv_filter_parse(char *expr)
result_t post_handler(struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
int target_os_signal_from_name(struct target *target, const char *name)
int probe_disable(struct probe *probe)
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)
void target_nv_filter_free(struct target_nv_filter *pf)
#define vwarnc(format,...)
char * base_thread_name_or_id
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)
int target_open(struct target *target)
void sigh_cleanup_probes(int signo, siginfo_t *siginfo, void *x)
int spf_signal(struct target *t, tid_t ctid, char *tiddesc, char *sigdesc)
char * overlay_debuginfo_prefix
char * symbol_get_name(struct symbol *symbol)
void * malloc(size_t size)
char * debugfile_root_prefix
struct target_thread * target_lookup_thread(struct target *target, tid_t tid)
#define array_list_foreach_fakeptr_t(alist, lpc, placeholder, intertype)
struct spf_action::@30::@40 signal
char * probe_name(struct probe *probe)
void spf_action_free(struct spf_action *spfa)
int target_os_signal_enqueue(struct target *target, tid_t tid, int signo, void *data)
struct target_spec * spec
int action_sched(struct probe *probe, struct action *action, action_whence_t whence, action_handler_t handler, void *handler_data)
int main(int argc, char **argv)
struct memregion * region
void target_driver_argp_init_children(struct argp_state *state)
struct spf_config * config