sim/ppc: Fix core_find_mapping diagnostics
authorTsukasa OI <research_trasio@irq.a4lg.com>
Wed, 12 Oct 2022 12:22:12 +0000 (12:22 +0000)
committerTsukasa OI <research_trasio@irq.a4lg.com>
Wed, 12 Oct 2022 13:21:31 +0000 (13:21 +0000)
Because "%p" is the pointer conversion specifier to print a pointer in an
implementation-defined manner, the result with format string containing
"0x%p" can be strange.  For instance, core_map_find_mapping prints error
containing "0x0x...." (processor is not NULL) or "0x(null)" (processor is
NULL) on glibc.

This commit replaces "0x%p" with "%p" to prevent unpredictable behavior.

sim/ppc/corefile.c

index b2faef58c5b53e0e191294ecb96992a1e69c3ff6..ee4e2cf733e4bd444e5485b95be5ec0befbed476 100644 (file)
@@ -292,7 +292,7 @@ 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%p cia=0x%x\n",
+    error("core_find_mapping() - access to unmaped address, attach a default map to handle this - addr=0x%x nr_bytes=0x%x processor=%p cia=0x%x\n",
          addr, nr_bytes, (void *) processor, cia);
   return NULL;
 }