Re: [PATCH v2 6/7] sim/ppc: Add ATTRIBUTE_PRINTF

Mike Frysinger via Gdb-patches
2022-10-23T14:00:57Z

[-- Attachment #1: Type: text/plain, Size: 1173 bytes --]

On 12 Oct 2022 10:39, Andrew Burgess wrote:
> --- a/sim/ppc/corefile.c
> +++ b/sim/ppc/corefile.c
> @@ -292,8 +292,8 @@ core_map_find_mapping(core_map *map,
> mapping = mapping->next;
> }
> if (abort)
> - error("core_find_mapping() - access to unmaped address, attach a default map to handle this - addr=0x%x nr_bytes=0x%x processor=0x%x cia=0x%x\n",
> - addr, nr_bytes, processor, cia);
> + error("core_find_mapping() - access to unmaped address, attach a default map to handle this - addr=0x%x nr_bytes=0x%x processor=0x%p cia=0x%x\n",

no 0x before %p

> + addr, nr_bytes, (void *) processor, cia);

why do you need (void*) cast ? %p takes pointer of any type.

> --- a/sim/ppc/emul_chirp.c
> +++ b/sim/ppc/emul_chirp.c
> @@ -1509,7 +1509,7 @@ map_over_chirp_note(bfd *image,
> return;
> /* check the name field */
> if (head.namesz > sizeof(name)) {
> - error("chirp: note name too long (%d > %d)\n", (int)head.namesz, sizeof(name));
> + error("chirp: note name too long (%d > %d)\n", (int)head.namesz, (int)sizeof(name));

please fix the format string instead of casting to random types.
sizeof uses %zu, not %d.
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]