On 11/28/19 7:46 PM, Alex Bennée wrote:
> + if (TRACE_TARGET_MMAP_ENABLED) {
> + char prot_str[4];
> + g_autoptr(GString) flag_str = g_string_new(NULL);
> +
> + pp_prot(&prot_str, prot);
> +
> + if (flags & MAP_FIXED) {
> + g_string_append(flag_str, "MAP_FIXED ");
> + }
> + if (flags & MAP_ANONYMOUS) {
> + g_string_append(flag_str, "MAP_ANON ");
> + }
> +
> + switch (flags & MAP_TYPE) {
> case MAP_PRIVATE:
> - printf("MAP_PRIVATE ");
> + g_string_append(flag_str, "MAP_PRIVATE ");
> break;
> case MAP_SHARED:
> - printf("MAP_SHARED ");
> + g_string_append(flag_str, "MAP_SHARED ");
> break;
> default:
> - printf("[MAP_TYPE=0x%x] ", flags & MAP_TYPE);
> + g_string_append_printf(flag_str, "[MAP_TYPE=0x%x] ",
> + flags & MAP_TYPE);
> break;
> }
> - printf("fd=%d offset=" TARGET_ABI_FMT_lx "\n", fd, offset);
> + trace_target_mmap(start, len, prot_str, flag_str->str, fd, offset);
> }
I don't think that you need to re-create -strace output.
There are also quite a lot of MAP_* flags that are not
being printed, without any indication that they are left out.
Again, I think we should just print the hex value.
r~