RFR(XXS): 7133111: libsaproc debug print should be printed as unsigned long to fit large numbers on 64bit platform

Daniel D. Daugherty daniel.daugherty at oracle.com
Thu Apr 5 07:06:59 PDT 2012


Staffan,

Thumbs up! The memsz field is a size_t so this change makes sense.
However, the bug synopsis recommending "unsigned long" threw me for
a second. I was wondering why '%zd' instead of '%zu'? After checking
out libproc_impl.h, I concur with your change.

Dan

On 4/5/12 6:25 AM, Staffan Larsen wrote:
> Please review the following one-character fix to a printf format string. A 'z' is added to the printout of a size_t field.
>
> Thanks,
> /Staffan
>
>
> diff --git a/agent/src/os/linux/ps_core.c b/agent/src/os/linux/ps_core.c
> --- a/agent/src/os/linux/ps_core.c
> +++ b/agent/src/os/linux/ps_core.c
> @@ -440,7 +440,7 @@
>         int j = 0;
>         print_debug("---- sorted virtual address map ----\n");
>         for (j = 0; j<  ph->core->num_maps; j++) {
> -        print_debug("base = 0x%lx\tsize = %d\n", ph->core->map_array[j]->vaddr,
> +        print_debug("base = 0x%lx\tsize = %zd\n", ph->core->map_array[j]->vaddr,
>                                            ph->core->map_array[j]->memsz);
>         }
>      }


More information about the serviceability-dev mailing list