Consistently call BaseName() in various Usage() functions.

Make various tools print just their names as part of the usage
instructions, rather than the full path. Also fix a missing space in the
dump_syms usage output.

Change-Id: I2b796678cd47e7dbabcc03df2b57cdc3420c008c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2787678
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Lei Zhang 2021-03-25 18:32:03 -07:00
parent 3bea2815bf
commit c484031f1f
9 changed files with 55 additions and 22 deletions

View file

@ -36,6 +36,7 @@
#include <string.h>
#include <unistd.h>
#include "common/path_helper.h"
#include "common/scoped_ptr.h"
#include "google_breakpad/processor/minidump.h"
#include "processor/logging.h"
@ -233,7 +234,7 @@ Usage(int argc, char *argv[], bool error) {
" <minidump> should be a minidump.\n"
" -x:\t Display memory in a hexdump like format\n"
" -h:\t Usage\n",
argv[0]);
google_breakpad::BaseName(argv[0]).c_str());
}
//=============================================================================

View file

@ -33,13 +33,15 @@
#include "client/linux/minidump_writer/minidump_writer.h"
#include "client/linux/minidump_writer/linux_core_dumper.h"
#include "common/path_helper.h"
using google_breakpad::AppMemoryList;
using google_breakpad::MappingList;
using google_breakpad::LinuxCoreDumper;
static int ShowUsage(const char* argv0) {
fprintf(stderr, "Usage: %s <core file> <procfs dir> <output>\n", argv0);
fprintf(stderr, "Usage: %s <core file> <procfs dir> <output>\n",
google_breakpad::BaseName(argv0).c_str());
return 1;
}

View file

@ -40,6 +40,7 @@
#include "client/linux/minidump_writer/linux_core_dumper.h"
#include "client/linux/minidump_writer/minidump_writer.h"
#include "common/path_helper.h"
#include "common/scoped_ptr.h"
namespace {
@ -58,7 +59,8 @@ using google_breakpad::scoped_array;
const int core_read_size = 1024 * 1024;
void ShowUsage(const char* argv0) {
fprintf(stderr, "Usage: %s <process id> <minidump file>\n\n", argv0);
fprintf(stderr, "Usage: %s <process id> <minidump file>\n\n",
google_breakpad::BaseName(argv0).c_str());
fprintf(stderr,
"A tool which serves as a core dump handler and produces "
"minidump files.\n");

View file

@ -37,13 +37,16 @@
#include <vector>
#include "common/linux/dump_symbols.h"
#include "common/path_helper.h"
using google_breakpad::WriteSymbolFile;
using google_breakpad::WriteSymbolFileHeader;
int usage(const char* self) {
fprintf(stderr, "Usage: %s [OPTION] <binary-with-debugging-info> "
"[directories-for-debug-file]\n\n", self);
fprintf(stderr,
"Usage: %s [OPTION] <binary-with-debugging-info> "
"[directories-for-debug-file]\n\n",
google_breakpad::BaseName(self).c_str());
fprintf(stderr, "Options:\n");
fprintf(stderr, " -i: Output module header information only.\n");
fprintf(stderr, " -c Do not generate CFI section\n");

View file

@ -34,10 +34,12 @@
#include <unistd.h>
#include "client/linux/minidump_writer/minidump_writer.h"
#include "common/path_helper.h"
int main(int argc, char* argv[]) {
if (argc != 3) {
fprintf(stderr, "Usage: %s <process id> <minidump file>\n\n", argv[0]);
fprintf(stderr, "Usage: %s <process id> <minidump file>\n\n",
google_breakpad::BaseName(argv[0]).c_str());
fprintf(stderr,
"A tool to generate a minidump from a running process. The process "
"resumes its\nactivity once the operation is completed. Permission "

View file

@ -41,6 +41,7 @@
#include <string>
#include "common/linux/http_upload.h"
#include "common/path_helper.h"
#include "common/using_std_string.h"
using google_breakpad::HTTPUpload;
@ -91,8 +92,10 @@ static void Start(Options *options) {
static void
Usage(int argc, const char *argv[]) {
fprintf(stderr, "Submit minidump information.\n");
fprintf(stderr, "Usage: %s [options...] -p <product> -v <version> <minidump> "
"<upload-URL>\n", argv[0]);
fprintf(stderr,
"Usage: %s [options...] -p <product> -v <version> <minidump> "
"<upload-URL>\n",
google_breakpad::BaseName(argv[0]).c_str());
fprintf(stderr, "Options:\n");
fprintf(stderr, "<minidump> should be a minidump.\n");
fprintf(stderr, "<upload-URL> is the destination for the upload\n");

View file

@ -47,6 +47,7 @@
#include <locale>
#include "common/linux/symbol_upload.h"
#include "common/path_helper.h"
using google_breakpad::sym_upload::UploadProtocol;
using google_breakpad::sym_upload::Options;
@ -66,10 +67,11 @@ static void
Usage(int argc, const char *argv[]) {
fprintf(stderr, "Submit symbol information.\n");
fprintf(stderr, "Usage: %s [options...] <symbol-file> <upload-URL>\n",
argv[0]);
google_breakpad::BaseName(argv[0]).c_str());
fprintf(stderr, "Options:\n");
fprintf(stderr, "<symbol-file> should be created by using the dump_syms"
"tool.\n");
fprintf(stderr,
"<symbol-file> should be created by using the dump_syms "
"tool.\n");
fprintf(stderr, "<upload-URL> is the destination for the upload\n");
fprintf(stderr, "-p:\t <protocol> One of ['sym-upload-v1',"
" 'sym-upload-v2'], defaults to 'sym-upload-v1'.\n");