Usually there is no need to scan every threads for every processes, as
they are very likely to share their address space between each
others. Thus, scanning only one of them is mostly enough.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
+#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, },
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";
{ .val = 'h', .name = "help", },
};
char short_options[] = "p:m:h";
+ printf("%c: %s\n", c, optarg);
switch (c) {
case 'p':
opts->pid = atoi(optarg);
switch (c) {
case 'p':
opts->pid = atoi(optarg);
opts->parse_mask |= PARSE_MAP_NAME;
opts->map_name = optarg;
break;
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]);
}
case 'h':
print_help_and_die(argv[0]);
}
int parse_mask;
int pid;
char *map_name;
int parse_mask;
int pid;
char *map_name;
- tid = get_next_tid(pid, &dir);
+ if (opts->with_threads)
+ tid = get_next_tid(pid, &dir);
+ else
+ tid = pid;
- read_pageframe(pid, pid, pageframe, process_list, opts);
+ read_pageframe(pid, tid, pageframe, process_list, opts);
+
+ if (!opts->with_threads)
+ break;