Hi Alex, Alex Bennée <alex.ben...@linaro.org> writes:
> Sven Schnelle <sv...@stackframe.org> writes: >> +static void parse_vaddr_match(GArray **matches, char *token) >> { >> - uint64_t v = g_ascii_strtoull(match, NULL, 16); >> + uint64_t low, high; >> + gchar *endp; >> >> - if (!matches) { >> - *matches = g_array_new(false, true, sizeof(uint64_t)); >> + low = g_ascii_strtoull(token, &endp, 16); >> + if (endp == token) { >> + fprintf(stderr, "Invalid address(range) specified: %s\n", token); >> + return; >> + } >> + >> + if (*endp != '-') { >> + high = low; >> + } else { >> + high = g_ascii_strtoull(endp + 1, &endp, 16); >> + if (endp == token) { >> + fprintf(stderr, "Invalid address(range) specified: %s\n", >> token); >> + return; >> + } >> + } >> + >> + if (!*matches) { >> + *matches = g_array_new(false, true, sizeof(struct address_match)); >> } >> - g_array_append_val(*matches, v); >> + struct address_match *match = g_new(struct address_match, 1); >> + match->low = low; >> + match->high = high; >> + g_array_append_val(*matches, match); > > This is almost but not quite qemu_set_dfilter_ranges(). I wonder if it > would be worth a light re-factoring and then exposing the parser as a > helper function? Thanks, I'll take a look. I wasn't aware of qemu_set_dfilter_ranges().