forked from Imagelibrary/binutils-gdb
sim/ppc: fixes for arguments to printf style functions
After the recent series of fixes to mark more functions in the simulator with ATTRIBUTE_PRINTF, there were some build failures in the ppc sim due, in some cases, to bugs with the arguments being passed, and in other cases, the issues were (maybe) less serious, with arguments being the wrong size, or type, for the printf format being used. This commit fixes all of the issues that I ran into. In each case I selected the easiest solution to the problem, which is usually just casting the argument to the correct type. If anyone later on thinks the print format should change, please feel free to do that. What we have here should keep the simulator basically working as it does currently, which is my goal with this commit.
This commit is contained in:
@@ -292,8 +292,8 @@ core_map_find_mapping(core_map *map,
|
|||||||
mapping = mapping->next;
|
mapping = mapping->next;
|
||||||
}
|
}
|
||||||
if (abort)
|
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",
|
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",
|
||||||
addr, nr_bytes, processor, cia);
|
addr, nr_bytes, (void *) processor, cia);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ emul_bugapi_instruction_call(cpu *processor,
|
|||||||
switch (call_id) {
|
switch (call_id) {
|
||||||
default:
|
default:
|
||||||
error("emul-bugapi: unimplemented bugapi %s from address 0x%lx\n",
|
error("emul-bugapi: unimplemented bugapi %s from address 0x%lx\n",
|
||||||
emul_bugapi_instruction_name (call_id), SRR0);
|
emul_bugapi_instruction_name (call_id), (unsigned long) SRR0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* read a single character, output r3 = byte */
|
/* read a single character, output r3 = byte */
|
||||||
|
|||||||
@@ -1509,7 +1509,7 @@ map_over_chirp_note(bfd *image,
|
|||||||
return;
|
return;
|
||||||
/* check the name field */
|
/* check the name field */
|
||||||
if (head.namesz > sizeof(name)) {
|
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));
|
||||||
}
|
}
|
||||||
if (!bfd_get_section_contents(image, sect,
|
if (!bfd_get_section_contents(image, sect,
|
||||||
name, sizeof(head), head.namesz)) {
|
name, sizeof(head), head.namesz)) {
|
||||||
@@ -1971,12 +1971,14 @@ emul_chirp_instruction_call(cpu *processor,
|
|||||||
}
|
}
|
||||||
if (emul_data->n_args > 6) { /* See iee1275 requirements on nr returns */
|
if (emul_data->n_args > 6) { /* See iee1275 requirements on nr returns */
|
||||||
error("OpenFirmware service %s called from 0x%lx with args 0x%lx, too many args (%d)\n",
|
error("OpenFirmware service %s called from 0x%lx with args 0x%lx, too many args (%d)\n",
|
||||||
|
service_name,
|
||||||
(unsigned long)emul_data->return_address,
|
(unsigned long)emul_data->return_address,
|
||||||
(unsigned long)emul_data->arguments,
|
(unsigned long)emul_data->arguments,
|
||||||
emul_data->n_returns);
|
emul_data->n_returns);
|
||||||
}
|
}
|
||||||
if (emul_data->n_returns > 6) {
|
if (emul_data->n_returns > 6) {
|
||||||
error("OpenFirmware service %s called from 0x%lx with args 0x%lx, with too many returns (%d)\n",
|
error("OpenFirmware service %s called from 0x%lx with args 0x%lx, with too many returns (%d)\n",
|
||||||
|
service_name,
|
||||||
(unsigned long)emul_data->return_address,
|
(unsigned long)emul_data->return_address,
|
||||||
(unsigned long)emul_data->arguments,
|
(unsigned long)emul_data->arguments,
|
||||||
emul_data->n_args);
|
emul_data->n_args);
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ instruction_storage_interrupt(cpu *processor,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
srr1_set = 0;
|
srr1_set = 0;
|
||||||
error("internal error - instruction_storage_interrupt - reason %d not implemented");
|
error("internal error - instruction_storage_interrupt - reason %d not implemented", reason);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TRACE(trace_interrupts, ("instruction storage interrupt - cia=0x%lx SRR1|=0x%lx\n",
|
TRACE(trace_interrupts, ("instruction storage interrupt - cia=0x%lx SRR1|=0x%lx\n",
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ find_arg(const char *err_msg,
|
|||||||
{
|
{
|
||||||
*ptr_to_argp += 1;
|
*ptr_to_argp += 1;
|
||||||
if (argv[*ptr_to_argp] == NULL)
|
if (argv[*ptr_to_argp] == NULL)
|
||||||
error(err_msg);
|
error("%s", err_msg);
|
||||||
return argv[*ptr_to_argp];
|
return argv[*ptr_to_argp];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,7 +535,7 @@ psim_create(const char *file_name,
|
|||||||
if (ppc_trace[trace_print_device_tree] || ppc_trace[trace_dump_device_tree])
|
if (ppc_trace[trace_print_device_tree] || ppc_trace[trace_dump_device_tree])
|
||||||
tree_print(root);
|
tree_print(root);
|
||||||
if (ppc_trace[trace_dump_device_tree])
|
if (ppc_trace[trace_dump_device_tree])
|
||||||
error("");
|
error("%s", "");
|
||||||
|
|
||||||
return system;
|
return system;
|
||||||
}
|
}
|
||||||
@@ -1186,7 +1186,7 @@ psim_merge_device_file(device *root,
|
|||||||
/* append the next line */
|
/* append the next line */
|
||||||
if (!fgets(device_path + curlen, sizeof(device_path) - curlen, description)) {
|
if (!fgets(device_path + curlen, sizeof(device_path) - curlen, description)) {
|
||||||
fclose(description);
|
fclose(description);
|
||||||
error("%s:%s: unexpected eof in line continuation - %s",
|
error("%s:%d: unexpected eof in line continuation - %s",
|
||||||
file_name, line_nr, device_path);
|
file_name, line_nr, device_path);
|
||||||
}
|
}
|
||||||
if (strchr(device_path, '\n') == NULL) {
|
if (strchr(device_path, '\n') == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user