projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eb24f1c
)
[sgen] Allow skipping of entries in `sgen-grep-binprot`.
author
Mark Probst
<mark.probst@gmail.com>
Thu, 5 Feb 2015 21:58:41 +0000
(13:58 -0800)
committer
Mark Probst
<mark.probst@gmail.com>
Mon, 23 Mar 2015 22:34:05 +0000
(15:34 -0700)
tools/sgen/sgen-grep-binprot.c
patch
|
blob
|
history
diff --git
a/tools/sgen/sgen-grep-binprot.c
b/tools/sgen/sgen-grep-binprot.c
index 5335f01e71baf7031f5aa6321c08dbe8baff7b1d..ae3b4227979f47da5725d936d1018ff8738123e0 100644
(file)
--- a/
tools/sgen/sgen-grep-binprot.c
+++ b/
tools/sgen/sgen-grep-binprot.c
@@
-594,6
+594,8
@@
main (int argc, char *argv[])
const char *input_path = NULL;
int input_file;
EntryStream stream;
const char *input_path = NULL;
int input_file;
EntryStream stream;
+ unsigned long long entry_index;
+ unsigned long long first_entry_to_consider = 0;
for (i = 0; i < num_args; ++i) {
char *arg = argv [i + 1];
for (i = 0; i < num_args; ++i) {
char *arg = argv [i + 1];
@@
-605,6
+607,9
@@
main (int argc, char *argv[])
} else if (!strcmp (arg, "-v") || !strcmp (arg, "--vtable")) {
vtables [num_vtables++] = strtoul (next_arg, NULL, 16);
++i;
} else if (!strcmp (arg, "-v") || !strcmp (arg, "--vtable")) {
vtables [num_vtables++] = strtoul (next_arg, NULL, 16);
++i;
+ } else if (!strcmp (arg, "-s") || !strcmp (arg, "--start-at")) {
+ first_entry_to_consider = strtoull (next_arg, NULL, 10);
+ ++i;
} else if (!strcmp (arg, "-c") || !strcmp (arg, "--color")) {
color_output = TRUE;
} else if (!strcmp (arg, "-i") || !strcmp (arg, "--input")) {
} else if (!strcmp (arg, "-c") || !strcmp (arg, "--color")) {
color_output = TRUE;
} else if (!strcmp (arg, "-i") || !strcmp (arg, "--input")) {
@@
-622,7
+627,10
@@
main (int argc, char *argv[])
input_file = input_path ? open (input_path, O_RDONLY) : STDIN_FILENO;
init_stream (&stream, input_file);
input_file = input_path ? open (input_path, O_RDONLY) : STDIN_FILENO;
init_stream (&stream, input_file);
+ entry_index = 0;
while ((type = read_entry (&stream, data)) != SGEN_PROTOCOL_EOF) {
while ((type = read_entry (&stream, data)) != SGEN_PROTOCOL_EOF) {
+ if (entry_index < first_entry_to_consider)
+ goto next_entry;
if (pause_times) {
switch (type) {
case PROTOCOL_ID (binary_protocol_world_stopping): {
if (pause_times) {
switch (type) {
case PROTOCOL_ID (binary_protocol_world_stopping): {
@@
-670,11
+678,15
@@
main (int argc, char *argv[])
}
}
}
}
}
}
+ if (match || dump_all)
+ printf ("%12lld ", entry_index);
if (dump_all)
printf (match ? "* " : " ");
if (match || dump_all)
print_entry (type, data, num_nums, match_indices, color_output);
}
if (dump_all)
printf (match ? "* " : " ");
if (match || dump_all)
print_entry (type, data, num_nums, match_indices, color_output);
}
+ next_entry:
+ ++entry_index;
}
close_stream (&stream);
if (input_path)
}
close_stream (&stream);
if (input_path)