zgetdump: Add verbose option

Add verbose option for zgetdump to display the detailed layout of memory
map when printing dump info for s390_ext or ELF dump format.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Mikhail Zaslonko
2018-02-28 22:24:47 +01:00
committed by Jan Höppner
parent 45ac847dc9
commit 15c22ec742
3 changed files with 24 additions and 3 deletions

View File

@@ -152,9 +152,24 @@ static void mem_map_print(void)
{
struct dfi_mem_chunk *mem_chunk;
u64 print_start = 0, print_end = 0;
const char *zero_str;
u32 volnr = 0;
STDERR("\nMemory map:\n");
/*
* Print each memory chunk if verbose specified
*/
if (g.opts.verbose_specified) {
dfi_mem_chunk_iterate(mem_chunk) {
zero_str = "";
if (mem_chunk->read_fn == dfi_mem_chunk_read_zero)
zero_str = " zeroes";
STDERR(" %016llx - %016llx (%llu MB%s)\n",
mem_chunk->start, mem_chunk->end,
TO_MIB(mem_chunk->size), zero_str);
}
return;
}
/*
* Merge adjacent memory chunks from the same volume
*/

View File

@@ -3,7 +3,7 @@
*
* Option parsing
*
* Copyright IBM Corp. 2001, 2017
* Copyright IBM Corp. 2001, 2018
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -46,9 +46,10 @@ static char help_text[] =
"-s, --select Select system data SYS (\"kdump\", \"prod\", or \"all\")\n"
"-d, --device Print DUMPDEV (dump device) information\n"
"-v, --version Print version information, then exit\n"
"-V, --verbose Show detailed layout of memory map on printing DUMP information\n"
"-h, --help Print this help, then exit\n";
static const char copyright_str[] = "Copyright IBM Corp. 2001, 2017";
static const char copyright_str[] = "Copyright IBM Corp. 2001, 2018";
/*
* Select option strings
@@ -251,9 +252,10 @@ void opts_parse(int argc, char *argv[])
{"fmt", required_argument, NULL, 'f'},
{"select", required_argument, NULL, 's'},
{"debug", no_argument, NULL, 'X'},
{"verbose", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0 }
};
static const char optstr[] = "hvidmus:f:X";
static const char optstr[] = "hvVidmus:f:X";
init_defaults();
while ((opt = getopt_long(argc, argv, optstr, long_opts, &idx)) != -1) {
@@ -262,6 +264,9 @@ void opts_parse(int argc, char *argv[])
print_help_exit();
case 'v':
print_version_exit();
case 'V':
g.opts.verbose_specified = 1;
break;
case 'i':
action_set(ZG_ACTION_DUMP_INFO);
break;

View File

@@ -35,6 +35,7 @@ struct options {
int argc_fuse;
const char *select;
int select_specified;
int verbose_specified;
};
extern const char *OPTS_SELECT_KDUMP;