On 3/5/25 07:39, Philippe Mathieu-Daudé wrote:
+void legacy_binary_info_init(const char *argv0)
+{
+ g_auto(GStrv) tokens = g_strsplit(argv0, G_DIR_SEPARATOR_S, -1);
+ unsigned count = 0;
+ const char *binary_name;
+
+ while (tokens[count]) {
+ count++;
+ }
+ assert(count > 0);
+ binary_name = tokens[count - 1];
This is g_path_get_basename().
+
+ for (size_t i = 0; i < ARRAY_SIZE(legacy_binary_infos); i++) {
+ if (!strcmp(legacy_binary_infos[i].binary_name, binary_name)) {
+ current_index = i;
+ return;
+ }
+ }
+ fprintf(stderr, "Missing legacy info for '%s' binary.\n", binary_name);
+ abort();
+}
I'm with Paolo that this should not abort here; Error is better.
Even if the caller supplies error_fatal.
When testing for errors before and after a patch, I often rename
the binary, e.g. qemu-system-aarch64-good / qemu-system-aarch64-bad.
Leaving it in the same build directory is required in order to let
it find the uninstalled rom images.
Is there a way we can preserve something akin to this?
Do we need to add the -target command-line option that Pierrick mooted?
r~