diff options
author | green <green@FreeBSD.org> | 2001-10-30 15:54:09 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2001-10-30 15:54:09 +0000 |
commit | 85a9f299f9ff18dd7fee037e0aee7e70d3971e7e (patch) | |
tree | 3af54369ee3af34acc584ccf59baf1a0dc95e078 /usr.bin/gprof/gprof.c | |
parent | 0bacb7acb24b620b0199d06b1a081160742a8cd5 (diff) | |
download | FreeBSD-src-85a9f299f9ff18dd7fee037e0aee7e70d3971e7e.zip FreeBSD-src-85a9f299f9ff18dd7fee037e0aee7e70d3971e7e.tar.gz |
Add -K support to gprof(1), which enables dynamic symbol resolution from
the currently-running kernel (and supercedes an executable file argument
given). With this change, properly-compiled KLD modules are now
able to be profiled.
Obtained from: NAI Labs CBOSS project
Funded by: DARPA
Diffstat (limited to 'usr.bin/gprof/gprof.c')
-rw-r--r-- | usr.bin/gprof/gprof.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c index dfb1e2c..79dafc7 100644 --- a/usr.bin/gprof/gprof.c +++ b/usr.bin/gprof/gprof.c @@ -125,6 +125,9 @@ main(argc, argv) addlist( ktolist , *++argv ); kflag = TRUE; break; + case 'K': + Kflag = TRUE; + break; case 'l': lflag = 1; Lflag = 0; @@ -162,8 +165,9 @@ main(argc, argv) /* * get information from the executable file. */ - if (elf_getnfile(a_outname, &defaultEs) == -1 && - aout_getnfile(a_outname, &defaultEs) == -1) + if ((Kflag && kernel_getnfile(a_outname, &defaultEs) == -1) || + (elf_getnfile(a_outname, &defaultEs) == -1 && + aout_getnfile(a_outname, &defaultEs) == -1)) errx(1, "%s: bad format", a_outname); /* * sort symbol table. |