aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-dedup.c
diff options
context:
space:
mode:
Diffstat (limited to 'libctf/ctf-dedup.c')
-rw-r--r--libctf/ctf-dedup.c290
1 files changed, 144 insertions, 146 deletions
diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c
index 77b34f4..b58b815 100644
--- a/libctf/ctf-dedup.c
+++ b/libctf/ctf-dedup.c
@@ -581,7 +581,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
#define ADD_CITER(citers, hval) \
do \
{ \
- whaterr = "updating citers"; \
+ whaterr = N_("error updating citers"); \
if (!citers) \
if ((citers = ctf_dynset_create (htab_hash_string, \
ctf_dynset_eq_string, \
@@ -610,14 +610,13 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
if ((hval = intern (fp, strdup (hashbuf))) == NULL)
{
- ctf_err_warn (fp, 0, "%s (%i): out of memory during forwarding-stub "
- "hashing for type with GID %p; errno: %s",
- ctf_link_input_name (input), input_num, type_id,
- strerror (errno));
+ ctf_err_warn (fp, 0, 0, _("%s (%i): out of memory during forwarding-"
+ "stub hashing for type with GID %p"),
+ ctf_link_input_name (input), input_num, type_id);
return NULL; /* errno is set for us. */
}
- /* In share--duplicated link mode, make sure the origin of this type is
+ /* In share-duplicated link mode, make sure the origin of this type is
recorded, even if this is a type in a parent dict which will not be
directly traversed. */
if (d->cd_link_flags & CTF_LINK_SHARE_DUPLICATED
@@ -680,7 +679,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
depth);
if (ctf_type_encoding (input, type, &ep) < 0)
{
- whaterr = "encoding";
+ whaterr = N_("error getting encoding");
goto err;
}
ctf_dedup_sha1_add (&hash, &ep, sizeof (ctf_encoding_t), "encoding",
@@ -699,7 +698,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
child_type, flags, depth,
populate_fun)) == NULL)
{
- whaterr = "referenced type hashing";
+ whaterr = N_("error doing referenced type hashing");
goto err;
}
ctf_dedup_sha1_add (&hash, hval, strlen (hval) + 1, "referenced type",
@@ -728,7 +727,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
child_type, flags, depth,
populate_fun)) == NULL)
{
- whaterr = "slice-referenced type hashing";
+ whaterr = N_("error doing slice-referenced type hashing");
goto err;
}
ctf_dedup_sha1_add (&hash, hval, strlen (hval) + 1, "sliced type",
@@ -753,7 +752,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
if (ctf_array_info (input, type, &ar) < 0)
{
- whaterr = "array info";
+ whaterr = N_("error getting array info");
goto err;
}
@@ -761,7 +760,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
ar.ctr_contents, flags, depth,
populate_fun)) == NULL)
{
- whaterr = "array contents type hashing";
+ whaterr = N_("error doing array contents type hashing");
goto err;
}
ctf_dedup_sha1_add (&hash, hval, strlen (hval) + 1, "array contents",
@@ -772,7 +771,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
ar.ctr_index, flags, depth,
populate_fun)) == NULL)
{
- whaterr = "array index type hashing";
+ whaterr = N_("error doing array index type hashing");
goto err;
}
ctf_dedup_sha1_add (&hash, hval, strlen (hval) + 1, "array index",
@@ -791,7 +790,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
if (ctf_func_type_info (input, type, &fi) < 0)
{
- whaterr = "func type info";
+ whaterr = N_("error getting func type info");
goto err;
}
@@ -799,7 +798,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
fi.ctc_return, flags, depth,
populate_fun)) == NULL)
{
- whaterr = "func return type";
+ whaterr = N_("error getting func return type");
goto err;
}
ctf_dedup_sha1_add (&hash, hval, strlen (hval) + 1, "func return",
@@ -812,14 +811,14 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
if ((args = calloc (fi.ctc_argc, sizeof (ctf_id_t))) == NULL)
{
- whaterr = "memory allocation";
+ whaterr = N_("error doing memory allocation");
goto err;
}
if (ctf_func_type_args (input, type, fi.ctc_argc, args) < 0)
{
free (args);
- whaterr = "func arg type";
+ whaterr = N_("error getting func arg type");
goto err;
}
for (j = 0; j < fi.ctc_argc; j++)
@@ -829,7 +828,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
populate_fun)) == NULL)
{
free (args);
- whaterr = "func arg type hashing";
+ whaterr = N_("error doing func arg type hashing");
goto err;
}
ctf_dedup_sha1_add (&hash, hval, strlen (hval) + 1, "func arg type",
@@ -854,7 +853,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
}
if (ctf_errno (input) != ECTF_NEXT_END)
{
- whaterr = "enum member iteration";
+ whaterr = N_("error doing enum member iteration");
goto err;
}
break;
@@ -887,7 +886,7 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
input_num, membtype, flags, depth,
populate_fun)) == NULL)
{
- whaterr = "struct/union member type hashing";
+ whaterr = N_("error doing struct/union member type hashing");
goto iterr;
}
@@ -899,26 +898,26 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
}
if (ctf_errno (input) != ECTF_NEXT_END)
{
- whaterr = "struct/union member iteration";
+ whaterr = N_("error doing struct/union member iteration");
goto err;
}
break;
}
default:
- whaterr = "unknown type kind";
+ whaterr = N_("error: unknown type kind");
goto err;
}
ctf_sha1_fini (&hash, hashbuf);
if ((hval = intern (fp, strdup (hashbuf))) == NULL)
{
- whaterr = "hash internment";
+ whaterr = N_("cannot intern hash");
goto oom;
}
/* Populate the citers for this type's subtypes, now the hash for the type
itself is known. */
- whaterr = "citer tracking";
+ whaterr = N_("error tracking citers");
if (citer)
{
@@ -957,17 +956,15 @@ ctf_dedup_rhash_type (ctf_file_t *fp, ctf_file_t *input, ctf_file_t **inputs,
ctf_next_destroy (i);
err:
ctf_sha1_fini (&hash, NULL);
- ctf_err_warn (fp, 0, "%s (%i): %s error during type hashing for "
- "type %lx, kind %i: CTF error: %s; errno: %s",
- ctf_link_input_name (input), input_num, whaterr, type,
- kind, ctf_errmsg (ctf_errno (fp)), strerror (errno));
+ ctf_err_warn (fp, 0, 0, _("%s (%i): %s: during type hashing for type %lx, "
+ "kind %i"), ctf_link_input_name (input),
+ input_num, gettext (whaterr), type, kind);
return NULL;
oom:
ctf_set_errno (fp, errno);
- ctf_err_warn (fp, 0, "%s (%i): %s error during type hashing for "
- "type %lx, kind %i: CTF error: %s; errno: %s",
- ctf_link_input_name (input), input_num, whaterr, type,
- kind, ctf_errmsg (ctf_errno (fp)), strerror (errno));
+ ctf_err_warn (fp, 0, 0, _("%s (%i): %s: during type hashing for type %lx, "
+ "kind %i"), ctf_link_input_name (input),
+ input_num, gettext (whaterr), type, kind);
return NULL;
}
@@ -1034,8 +1031,10 @@ ctf_dedup_hash_type (ctf_file_t *fp, ctf_file_t *input,
if ((tp = ctf_lookup_by_id (&input, type)) == NULL)
{
- ctf_err_warn (fp, 0, "%s (%i): lookup failure for type %lx: flags %x",
- ctf_link_input_name (input), input_num, type, flags);
+ ctf_set_errno (fp, ctf_errno (input));
+ ctf_err_warn (fp, 0, 0, _("%s (%i): lookup failure for type %lx: "
+ "flags %x"), ctf_link_input_name (input),
+ input_num, type, flags);
return NULL; /* errno is set for us. */
}
@@ -1106,14 +1105,14 @@ ctf_dedup_hash_type (ctf_file_t *fp, ctf_file_t *input,
if (ctf_dynhash_cinsert (d->cd_type_hashes, type_id, hval) < 0)
{
- whaterr = "hash caching";
+ whaterr = N_("error hash caching");
goto oom;
}
if (populate_fun (fp, input, inputs, input_num, type, type_id,
decorated, hval) < 0)
{
- whaterr = "population function";
+ whaterr = N_("error calling population function");
goto err; /* errno is set for us. */
}
}
@@ -1127,11 +1126,10 @@ ctf_dedup_hash_type (ctf_file_t *fp, ctf_file_t *input,
oom:
ctf_set_errno (fp, errno);
err:
- ctf_err_warn (fp, 0, "%s (%i): %s error during type hashing, type %lx, "
- "kind %i: CTF errno: %s; errno: %s",
- ctf_link_input_name (input), input_num, whaterr, type,
- kind, ctf_errmsg (ctf_errno (fp)),
- strerror (errno));
+ ctf_err_warn (fp, 0, 0, _("%s (%i): %s: during type hashing, "
+ "type %lx, kind %i"),
+ ctf_link_input_name (input), input_num,
+ gettext (whaterr), type, kind);
return NULL;
}
@@ -1218,7 +1216,7 @@ ctf_dedup_populate_mappings (ctf_file_t *fp, ctf_file_t *input _libctf_unused_,
ctf_id_t bar = CTF_DEDUP_GID_TO_TYPE (one_id);
if (ctf_type_kind_unsliced (foo, bar) != orig_kind)
{
- ctf_err_warn (fp, 1, "added wrong kind to output mapping "
+ ctf_err_warn (fp, 1, 0, "added wrong kind to output mapping "
"for hash %s named %s: %p/%lx from %s is "
"kind %i, but newly-added %p/%lx from %s is "
"kind %i", hval,
@@ -1410,7 +1408,7 @@ ctf_dedup_detect_name_ambiguity (ctf_file_t *fp, ctf_file_t **inputs)
void *k;
void *v;
int err;
- const char *erm;
+ const char *whaterr;
/* Go through cd_name_counts for all CTF namespaces in turn. */
@@ -1474,7 +1472,7 @@ ctf_dedup_detect_name_ambiguity (ctf_file_t *fp, ctf_file_t **inputs)
}
if (err != ECTF_NEXT_END)
{
- erm = "marking conflicting structs/unions";
+ whaterr = N_("error marking conflicting structs/unions");
goto iterr;
}
}
@@ -1511,7 +1509,7 @@ ctf_dedup_detect_name_ambiguity (ctf_file_t *fp, ctf_file_t **inputs)
}
if (err != ECTF_NEXT_END)
{
- erm = "finding commonest conflicting type";
+ whaterr = N_("error finding commonest conflicting type");
goto iterr;
}
@@ -1526,20 +1524,20 @@ ctf_dedup_detect_name_ambiguity (ctf_file_t *fp, ctf_file_t **inputs)
hval, (const char *) k);
if (ctf_dedup_mark_conflicting_hash (fp, hval) < 0)
{
- erm = "marking hashes as conflicting";
+ whaterr = N_("error marking hashes as conflicting");
goto err;
}
}
if (err != ECTF_NEXT_END)
{
- erm = "marking uncommon conflicting types";
+ whaterr = N_("marking uncommon conflicting types");
goto iterr;
}
}
}
if (err != ECTF_NEXT_END)
{
- erm = "scanning for ambiguous names";
+ whaterr = N_("scanning for ambiguous names");
goto iterr;
}
@@ -1547,11 +1545,11 @@ ctf_dedup_detect_name_ambiguity (ctf_file_t *fp, ctf_file_t **inputs)
err:
ctf_next_destroy (i);
- ctf_err_warn (fp, 0, "%s: %s", erm, ctf_errmsg (ctf_errno (fp)));
- return -1;
+ ctf_err_warn (fp, 0, 0, "%s", gettext (whaterr));
+ return -1; /* errno is set for us. */
iterr:
- ctf_err_warn (fp, 0, "iteration failed %s: %s", erm, ctf_errmsg (err));
+ ctf_err_warn (fp, 0, err, _("iteration failed: %s"), gettext (whaterr));
return ctf_set_errno (fp, err);
assert_err:
@@ -1642,8 +1640,8 @@ ctf_dedup_init (ctf_file_t *fp)
return 0;
oom:
- ctf_err_warn (fp, 0, "ctf_dedup_init: cannot initialize: "
- "out of memory.");
+ ctf_err_warn (fp, 0, ENOMEM, _("ctf_dedup_init: cannot initialize: "
+ "out of memory"));
return ctf_set_errno (fp, ENOMEM);
}
@@ -1740,10 +1738,9 @@ ctf_dedup_multiple_input_dicts (ctf_file_t *output, ctf_file_t **inputs,
}
if ((err != ECTF_NEXT_END) && (err != 0))
{
- ctf_err_warn (output, 0, "propagating conflictedness: %s",
- ctf_errmsg (err));
- ctf_set_errno (output, err);
- return -1;
+ ctf_err_warn (output, 0, err, _("iteration error "
+ "propagating conflictedness"));
+ return ctf_set_errno (output, err);
}
if (multiple)
@@ -1836,11 +1833,9 @@ ctf_dedup_conflictify_unshared (ctf_file_t *output, ctf_file_t **inputs)
err = ctf_errno (output);
ctf_next_destroy (i);
iterr:
- ctf_set_errno (output, err);
ctf_dynset_destroy (to_mark);
- ctf_err_warn (output, 0, "conflictifying unshared types: %s",
- ctf_errmsg (ctf_errno (output)));
- return -1;
+ ctf_err_warn (output, 0, err, _("conflictifying unshared types"));
+ return ctf_set_errno (output, err);
}
/* The core deduplicator. Populate cd_output_mapping in the output ctf_dedup
@@ -1899,9 +1894,10 @@ ctf_dedup (ctf_file_t *output, ctf_file_t **inputs, uint32_t ninputs,
}
if (ctf_errno (inputs[i]) != ECTF_NEXT_END)
{
- ctf_err_warn (output, 0, "iteration failure computing type "
- "hashes: %s", ctf_errmsg (ctf_errno (inputs[i])));
- return ctf_set_errno (output, ctf_errno (inputs[i]));
+ ctf_set_errno (output, ctf_errno (inputs[i]));
+ ctf_err_warn (output, 0, 0, _("iteration failure "
+ "computing type hashes"));
+ return -1;
}
}
@@ -2013,7 +2009,7 @@ ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
hashval = ctf_dynhash_lookup (d->cd_type_hashes, type_id); \
if (!ctf_assert (output, hashval)) \
{ \
- whaterr = "looking up ID in type hashes"; \
+ whaterr = N_("error looking up ID in type hashes"); \
goto errlabel; \
} \
ctf_dprintf ("ID %i/%lx has hash %s\n", cited_type_input_num, type, \
@@ -2048,7 +2044,7 @@ ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
case CTF_K_POINTER:
case CTF_K_SLICE:
CTF_TYPE_WALK (ctf_type_reference (fp, type), err,
- "Referenced type walk");
+ N_("error during referenced type walk"));
break;
case CTF_K_ARRAY:
@@ -2057,12 +2053,14 @@ ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
if (ctf_array_info (fp, type, &ar) < 0)
{
- whaterr = "array info lookup";
+ whaterr = N_("error during array info lookup");
goto err_msg;
}
- CTF_TYPE_WALK (ar.ctr_contents, err, "Array contents type walk");
- CTF_TYPE_WALK (ar.ctr_index, err, "Array index type walk");
+ CTF_TYPE_WALK (ar.ctr_contents, err,
+ N_("error during array contents type walk"));
+ CTF_TYPE_WALK (ar.ctr_index, err,
+ N_("error during array index type walk"));
break;
}
@@ -2074,27 +2072,29 @@ ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
if (ctf_func_type_info (fp, type, &fi) < 0)
{
- whaterr = "func type info lookup";
+ whaterr = N_("error during func type info lookup");
goto err_msg;
}
- CTF_TYPE_WALK (fi.ctc_return, err, "Func return type walk");
+ CTF_TYPE_WALK (fi.ctc_return, err,
+ N_("error during func return type walk"));
if ((args = calloc (fi.ctc_argc, sizeof (ctf_id_t))) == NULL)
{
- whaterr = "memory allocation";
+ whaterr = N_("error doing memory allocation");
goto err_msg;
}
if (ctf_func_type_args (fp, type, fi.ctc_argc, args) < 0)
{
- whaterr = "func arg type lookup";
+ whaterr = N_("error doing func arg type lookup");
free (args);
goto err_msg;
}
for (j = 0; j < fi.ctc_argc; j++)
- CTF_TYPE_WALK (args[j], err_free_args, "Func arg type walk");
+ CTF_TYPE_WALK (args[j], err_free_args,
+ N_("error during Func arg type walk"));
free (args);
break;
@@ -2108,8 +2108,8 @@ ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
emitted later, in a separate pass. */
break;
default:
- whaterr = "unknown type kind";
- goto err;
+ whaterr = N_("CTF dict corruption: unknown type kind");
+ goto err_msg;
}
return visit_fun (hval, output, inputs, ninputs, parents, visited, fp, type,
@@ -2117,8 +2117,8 @@ ctf_dedup_rwalk_one_output_mapping (ctf_file_t *output,
err_msg:
ctf_set_errno (output, ctf_errno (fp));
- ctf_err_warn (fp, 0, "%s during type walking in %s at ID %lx: %s", whaterr,
- ctf_link_input_name (fp), type, ctf_errmsg (ctf_errno (fp)));
+ ctf_err_warn (output, 0, 0, _("%s in input file %s at type ID %lx"),
+ gettext (whaterr), ctf_link_input_name (fp), type);
err:
return -1;
}
@@ -2157,8 +2157,8 @@ ctf_dedup_rwalk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
type_ids = ctf_dynhash_lookup (d->cd_output_mapping, hval);
if (!type_ids)
{
- ctf_err_warn (output, 0, "looked up type kind by nonexistent "
- "hash %s.", hval);
+ ctf_err_warn (output, 0, ECTF_INTERNAL,
+ _("looked up type kind by nonexistent hash %s"), hval);
return ctf_set_errno (output, ECTF_INTERNAL);
}
@@ -2175,8 +2175,8 @@ ctf_dedup_rwalk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
visited = 0;
if (ctf_dynset_cinsert (already_visited, hval) < 0)
{
- ctf_err_warn (output, 0, "out of memory tracking already-visited "
- "types.");
+ ctf_err_warn (output, 0, ENOMEM,
+ _("out of memory tracking already-visited types"));
return ctf_set_errno (output, ENOMEM);
}
}
@@ -2213,8 +2213,7 @@ ctf_dedup_rwalk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
}
if (err != ECTF_NEXT_END)
{
- ctf_err_warn (output, 0, "walking many types with one hash: %s",
- ctf_errmsg (err));
+ ctf_err_warn (output, 0, err, _("cannot walk conflicted type"));
return ctf_set_errno (output, err);
}
@@ -2336,8 +2335,7 @@ ctf_dedup_walk_output_mapping (ctf_file_t *output, ctf_file_t **inputs,
}
if (err != ECTF_NEXT_END)
{
- ctf_err_warn (output, 0, "recursing over output mapping: %s",
- ctf_errmsg (err));
+ ctf_err_warn (output, 0, err, _("cannot recurse over output mapping"));
ctf_set_errno (output, err);
goto err;
}
@@ -2490,8 +2488,8 @@ ctf_dedup_id_to_target (ctf_file_t *output, ctf_file_t *target,
break;
case -1:
ctf_set_errno (err_fp, ctf_errno (output));
- ctf_err_warn (err_fp, 0, "adding synthetic forward for type %i/%lx: "
- "%s", input_num, id, ctf_errmsg (ctf_errno (err_fp)));
+ ctf_err_warn (err_fp, 0, 0, _("cannot add synthetic forward for type "
+ "%i/%lx"), input_num, id);
return -1;
default:
return emitted_forward;
@@ -2518,10 +2516,10 @@ ctf_dedup_id_to_target (ctf_file_t *output, ctf_file_t *target,
case 0: /* No forward needed. */
break;
case -1:
- ctf_set_errno (err_fp, ctf_errno (output));
- ctf_err_warn (err_fp, 0, "adding synthetic forward for type %i/%lx: "
- "%s", input_num, id, ctf_errmsg (ctf_errno (err_fp)));
- return -1;
+ ctf_err_warn (err_fp, 0, ctf_errno (output),
+ _("cannot add synthetic forward for type %i/%lx"),
+ input_num, id);
+ return ctf_set_errno (err_fp, ctf_errno (output));
default:
return emitted_forward;
}
@@ -2570,7 +2568,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
ctf_id_t ref;
ctf_id_t maybe_dup = 0;
ctf_encoding_t ep;
- const char *erm;
+ const char *errtype;
int emission_hashed = 0;
/* We don't want to re-emit something we've already emitted. */
@@ -2600,10 +2598,10 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
if ((target = ctf_create (&err)) == NULL)
{
- ctf_err_warn (output, 0, "cannot create per-CU CTF archive "
- "for CU %s: %s", ctf_link_input_name (input),
- ctf_errmsg (err)); ctf_set_errno (output, err);
- return -1;
+ ctf_err_warn (output, 0, err,
+ _("cannot create per-CU CTF archive for CU %s"),
+ ctf_link_input_name (input));
+ return ctf_set_errno (output, err);
}
ctf_import_unref (target, output);
@@ -2621,11 +2619,10 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
real_input = input;
if ((tp = ctf_lookup_by_id (&real_input, type)) == NULL)
{
- ctf_err_warn (output, 0, "%s: lookup failure for type %lx: %s",
- ctf_link_input_name (real_input), type,
- ctf_errmsg (ctf_errno (input)));
- ctf_set_errno (output, ctf_errno (input));
- return -1; /* errno is set for us. */
+ ctf_err_warn (output, 0, ctf_errno (input),
+ _("%s: lookup failure for type %lx"),
+ ctf_link_input_name (real_input), type);
+ return ctf_set_errno (output, ctf_errno (input));
}
name = ctf_strraw (real_input, tp->ctt_name);
@@ -2667,7 +2664,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
/* This will do nothing if the type to which this forwards already exists,
and will be replaced with such a type if it appears later. */
- erm = "forward";
+ errtype = _("forward");
if ((new_type = ctf_add_forward (target, isroot, name,
ctf_type_kind_forwarded (input, type)))
== CTF_ERR)
@@ -2676,7 +2673,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
case CTF_K_FLOAT:
case CTF_K_INTEGER:
- erm = "float/int";
+ errtype = _("float/int");
if (ctf_type_encoding (input, type, &ep) < 0)
goto err_input; /* errno is set for us. */
if ((new_type = ctf_add_encoded (target, isroot, name, &ep, kind))
@@ -2687,7 +2684,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
case CTF_K_ENUM:
{
int val;
- erm = "enum";
+ errtype = _("enum");
if ((new_type = ctf_add_enum (target, isroot, name)) == CTF_ERR)
goto err_input; /* errno is set for us. */
@@ -2695,10 +2692,11 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
{
if (ctf_add_enumerator (target, new_type, name, val) < 0)
{
- ctf_err_warn (target, 0, "%s (%i): cannot add enumeration "
- "value %s from input type %lx: %s",
+ ctf_err_warn (target, 0, ctf_errno (target),
+ _("%s (%i): cannot add enumeration value %s "
+ "from input type %lx"),
ctf_link_input_name (input), input_num, name,
- type, ctf_errmsg (ctf_errno (target)));
+ type);
ctf_next_destroy (i);
return ctf_set_errno (output, ctf_errno (target));
}
@@ -2709,7 +2707,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
}
case CTF_K_TYPEDEF:
- erm = "typedef";
+ errtype = _("typedef");
ref = ctf_type_reference (input, type);
if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
@@ -2725,7 +2723,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
case CTF_K_CONST:
case CTF_K_RESTRICT:
case CTF_K_POINTER:
- erm = "pointer or cvr-qual";
+ errtype = _("pointer or cvr-qual");
ref = ctf_type_reference (input, type);
if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
@@ -2738,7 +2736,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
break;
case CTF_K_SLICE:
- erm = "slice";
+ errtype = _("slice");
if (ctf_type_encoding (input, type, &ep) < 0)
goto err_input; /* errno is set for us. */
@@ -2757,7 +2755,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
{
ctf_arinfo_t ar;
- erm = "array info";
+ errtype = _("array info");
if (ctf_array_info (input, type, &ar) < 0)
goto err_input;
@@ -2783,7 +2781,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
ctf_id_t *args;
uint32_t j;
- erm = "function";
+ errtype = _("function");
if (ctf_func_type_info (input, type, &fi) < 0)
goto err_input;
@@ -2799,7 +2797,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
goto err_input;
}
- erm = "function args";
+ errtype = _("function args");
if (ctf_func_type_args (input, type, fi.ctc_argc, args) < 0)
{
free (args);
@@ -2832,7 +2830,7 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
void *out_id;
/* Insert the structure itself, so other types can refer to it. */
- erm = "structure/union";
+ errtype = _("structure/union");
if (kind == CTF_K_STRUCT)
new_type = ctf_add_struct_sized (target, isroot, name, size);
else
@@ -2850,9 +2848,10 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
break;
}
default:
- ctf_err_warn (output, 0, "%s: unknown type kind for input type %lx",
+ ctf_err_warn (output, 0, ECTF_CORRUPT, _("%s: unknown type kind for "
+ "input type %lx"),
ctf_link_input_name (input), type);
- return -1;
+ return ctf_set_errno (output, ECTF_CORRUPT);
}
if (!emission_hashed
@@ -2860,8 +2859,8 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
&& ctf_dynhash_cinsert (target->ctf_dedup.cd_output_emission_hashes,
hval, (void *) (uintptr_t) new_type) < 0)
{
- ctf_err_warn (output, 0, "out of memory tracking deduplicated "
- "global type IDs");
+ ctf_err_warn (output, 0, ENOMEM, _("out of memory tracking deduplicated "
+ "global type IDs"));
return ctf_set_errno (output, ENOMEM);
}
@@ -2873,22 +2872,23 @@ ctf_dedup_emit_type (const char *hval, ctf_file_t *output, ctf_file_t **inputs,
return 0;
oom_hash:
- ctf_err_warn (output, 0, "out of memory creating emission-tracking hashes");
+ ctf_err_warn (output, 0, ENOMEM, _("out of memory creating emission-tracking "
+ "hashes"));
return ctf_set_errno (output, ENOMEM);
err_input:
- ctf_err_warn (output, 0, "%s (%i): while emitting deduplicated %s, error "
- "getting input type %lx: %s", ctf_link_input_name (input),
- input_num,erm, type, ctf_errmsg (ctf_errno (input)));
- ctf_set_errno (output, ctf_errno (input));
- return -1;
+ ctf_err_warn (output, 0, ctf_errno (input),
+ _("%s (%i): while emitting deduplicated %s, error getting "
+ "input type %lx"), ctf_link_input_name (input),
+ input_num, errtype, type);
+ return ctf_set_errno (output, ctf_errno (input));
err_target:
- ctf_err_warn (output, 0, "%s (%i): while emitting deduplicated %s, error "
- "emitting target type from input type %lx: %s",
- ctf_link_input_name (input), input_num, erm, type,
- ctf_errmsg (ctf_errno (target)));
- ctf_set_errno (output, ctf_errno (target));
- return -1;
+ ctf_err_warn (output, 0, ctf_errno (target),
+ _("%s (%i): while emitting deduplicated %s, error emitting "
+ "target type from input type %lx"),
+ ctf_link_input_name (input), input_num,
+ errtype, type);
+ return ctf_set_errno (output, ctf_errno (target));
}
/* Traverse the cd_emission_struct_members and emit the members of all
@@ -2978,16 +2978,14 @@ ctf_dedup_emit_struct_members (ctf_file_t *output, ctf_file_t **inputs,
return 0;
err_target:
ctf_next_destroy (i);
- ctf_err_warn (output, 0, "%s (%i): error emitting members for structure "
- "type %lx: %s", ctf_link_input_name (input_fp), input_num,
- err_type, ctf_errmsg (ctf_errno (err_fp)));
- ctf_set_errno (output, ctf_errno (err_fp));
- return -1;
+ ctf_err_warn (output, 0, ctf_errno (err_fp),
+ _("%s (%i): error emitting members for structure type %lx"),
+ ctf_link_input_name (input_fp), input_num, err_type);
+ return ctf_set_errno (output, ctf_errno (err_fp));
iterr:
- ctf_err_warn (output, 0, "iteration failure emitting structure members: %s",
- ctf_errmsg (err));
- ctf_set_errno (output, err);
- return -1;
+ ctf_err_warn (output, 0, err, _("iteration failure emitting "
+ "structure members"));
+ return ctf_set_errno (output, err);
}
/* Populate the type mapping used by the types in one FP (which must be an input
@@ -3052,8 +3050,7 @@ ctf_dedup_populate_type_mapping (ctf_file_t *shared, ctf_file_t *fp,
return 0;
err:
- ctf_err_warn (shared, 0, "iteration error populating the type mapping: %s",
- ctf_errmsg (err));
+ ctf_err_warn (shared, 0, err, _("iteration error populating the type mapping"));
return ctf_set_errno (shared, err);
}
@@ -3067,8 +3064,8 @@ ctf_dedup_populate_type_mappings (ctf_file_t *output, ctf_file_t **inputs,
if (ctf_dedup_populate_type_mapping (output, output, inputs) < 0)
{
- ctf_err_warn (output, 0, "cannot populate type mappings for shared "
- "CTF dict: %s", ctf_errmsg (ctf_errno (output)));
+ ctf_err_warn (output, 0, 0, _("cannot populate type mappings for shared "
+ "CTF dict"));
return -1; /* errno is set for us. */
}
@@ -3076,8 +3073,8 @@ ctf_dedup_populate_type_mappings (ctf_file_t *output, ctf_file_t **inputs,
{
if (ctf_dedup_populate_type_mapping (output, inputs[i], inputs) < 0)
{
- ctf_err_warn (output, 0, "cannot populate type mappings for per-CU "
- "CTF dict: %s", ctf_errmsg (ctf_errno (inputs[i])));
+ ctf_err_warn (output, 0, ctf_errno (inputs[i]),
+ _("cannot populate type mappings for per-CU CTF dict"));
return ctf_set_errno (output, ctf_errno (inputs[i]));
}
}
@@ -3129,7 +3126,8 @@ ctf_dedup_emit (ctf_file_t *output, ctf_file_t **inputs, uint32_t ninputs,
if ((outputs = calloc (num_outputs, sizeof (ctf_file_t *))) == NULL)
{
- ctf_err_warn (output, 0, "out of memory allocating link outputs array");
+ ctf_err_warn (output, 0, ENOMEM,
+ _("out of memory allocating link outputs array"));
ctf_set_errno (output, ENOMEM);
return NULL;
}