exit(0);
}
+#define OPT_WITH_THREADS 0x101
+
void read_args(int argc, char *argv[], struct parse_opts *opts)
{
int optind = 0, c;
static struct option long_options[] = {
{ .val = 'p', .name = "pid", .has_arg = 1, },
{ .val = 'm', .name = "map", .has_arg = 1, },
+ { .val = OPT_WITH_THREADS, .name = "with-threads" },
{ .val = 'h', .name = "help", },
};
char short_options[] = "p:m:h";
if (c == -1)
break;
+ printf("%c: %s\n", c, optarg);
switch (c) {
case 'p':
opts->pid = atoi(optarg);
opts->parse_mask |= PARSE_MAP_NAME;
opts->map_name = optarg;
break;
+ case OPT_WITH_THREADS:
+ opts->with_threads = 1;
+ break;
case 'h':
print_help_and_die(argv[0]);
}
int tid;
while (1) {
- tid = get_next_tid(pid, &dir);
+ if (opts->with_threads)
+ tid = get_next_tid(pid, &dir);
+ else
+ tid = pid;
if (tid <= 0)
return;
- read_pageframe(pid, pid, pageframe, process_list, opts);
+ read_pageframe(pid, tid, pageframe, process_list, opts);
+
+ if (!opts->with_threads)
+ break;
}
}