Skip to content

Commit

Permalink
btf_loader: Send warnings to stderr
Browse files Browse the repository at this point in the history
Among other things, this helps simplify tests/btf_functions.sh.

Signed-off-by: Alan Maguire <[email protected]>
Cc: Eduard Zingerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
alan-maguire authored and acmel committed Oct 23, 2024
1 parent e91433c commit 0ee4725
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions btf_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static int create_new_tag(struct cu *cu, int type, const struct btf_type *tp, ui
case BTF_KIND_TYPE_TAG: tag->tag = DW_TAG_LLVM_annotation; break;
default:
free(tag);
printf("%s: Unknown type %d\n\n", __func__, type);
fprintf(stderr, "%s: Unknown type %d\n\n", __func__, type);
return 0;
}

Expand All @@ -470,15 +470,16 @@ static int process_decl_tag(struct cu *cu, const struct btf_type *tp)
tag = cu__tag(cu, tp->type);

if (tag == NULL) {
printf("WARNING: BTF_KIND_DECL_TAG for unknown BTF id %d\n", tp->type);
fprintf(stderr, "WARNING: BTF_KIND_DECL_TAG for unknown BTF id %d\n", tp->type);
return 0;
}

const char *attribute = cu__btf_str(cu, tp->name_off);

if (tag->attribute != NULL) {
char bf[128];
printf("WARNING: still unsuported BTF_KIND_DECL_TAG(%s) for %s already with attribute (%s), ignoring\n",

fprintf(stderr, "WARNING: still unsuported BTF_KIND_DECL_TAG(%s) for %s already with attribute (%s), ignoring\n",
attribute, tag__name(tag, cu, bf, sizeof(bf), NULL), tag->attribute);
} else {
tag->attribute = attribute;
Expand Down

0 comments on commit 0ee4725

Please sign in to comment.