Skip to content

Commit

Permalink
pahole: Check if the sole arg is a file, not considering it a type if so
Browse files Browse the repository at this point in the history
Before we would have:

  $ gcc x.c -Wall -ggdb3
  $ strip -s a.out
  $ pahole ./a.out
  $

I.e. no types, no output.

Then when we started trying out the sole arg as a type to lookup either
on a vmlinux found via its build id in /sys/kernel/notes or
/sys/kernel/btf/vmlinux we instead showed this for a binary without type
info:

  $ pahole ./a.out
  pahole: type './a.out' not found
  $

Now we show:

  $ pahole a.out
  pahole: file 'a.out' has no supported type information.
  $

Reported-by: Jan Engelhardt <[email protected]>
Bugtracker: #14
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Nov 10, 2020
1 parent f47b3a2 commit fc06ee1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pahole.c
Original file line number Diff line number Diff line change
Expand Up @@ -2707,6 +2707,11 @@ int main(int argc, char *argv[])
if (err != 0) {
if (class_name == NULL && !btf_encode && !ctf_encode) {
class_name = argv[remaining];
if (access(class_name, R_OK) == 0) {
fprintf(stderr, "pahole: file '%s' has no %s type information.\n",
class_name, conf_load.format_path ?: "supported");
goto out_dwarves_exit;
}
remaining = argc;
goto try_sole_arg_as_class_names;
}
Expand Down

0 comments on commit fc06ee1

Please sign in to comment.