mirror of
https://github.com/golang/go
synced 2024-11-26 16:46:58 -07:00
cmd/addr2line: exit 0 for --help
This is what pprof expects, or else it won't use the program. And if it doesn't use the program, it gets very bad results. Fixes #4818. R=golang-dev, r CC=golang-dev https://golang.org/cl/7728043
This commit is contained in:
parent
401e0fea3a
commit
d2be8f2948
@ -11,13 +11,19 @@
|
|||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <mach.h>
|
#include <mach.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
printusage(int fd)
|
||||||
|
{
|
||||||
|
fprint(fd, "usage: addr2line binary\n");
|
||||||
|
fprint(fd, "reads addresses from standard input and writes two lines for each:\n");
|
||||||
|
fprint(fd, "\tfunction name\n");
|
||||||
|
fprint(fd, "\tfile:line\n");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: addr2line binary\n");
|
printusage(2);
|
||||||
fprint(2, "reads addresses from standard input and writes two lines for each:\n");
|
|
||||||
fprint(2, "\tfunction name\n");
|
|
||||||
fprint(2, "\tfile:line\n");
|
|
||||||
exits("usage");
|
exits("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +38,11 @@ main(int argc, char **argv)
|
|||||||
Biobuf bin, bout;
|
Biobuf bin, bout;
|
||||||
char file[1024];
|
char file[1024];
|
||||||
|
|
||||||
|
if(argc > 1 && strcmp(argv[1], "--help") == 0) {
|
||||||
|
printusage(1);
|
||||||
|
exits(0);
|
||||||
|
}
|
||||||
|
|
||||||
ARGBEGIN{
|
ARGBEGIN{
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
Loading…
Reference in New Issue
Block a user