This adds the ability to the strings program to display strings that contain \n and \r characters.
* strings.c: Add -w/--include-all-whitespace option to include any whitespace character in the displayed strings. * NEWS: Mention the new feature. * doc/binutils.texi (strings): Document the new command line option.
This commit is contained in:
parent
6ddf779d8e
commit
334ac421ef
4 changed files with 36 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2014-06-26 Erik Akermann <kurterikackermann@gmail.com>
|
||||||
|
|
||||||
|
* strings.c: Add -w/--include-all-whitespace option to include any
|
||||||
|
whitespace character in the displayed strings.
|
||||||
|
* NEWS: Mention the new feature.
|
||||||
|
* doc/binutils.texi (strings): Document the new command line
|
||||||
|
option.
|
||||||
|
|
||||||
2014-06-26 Nick Clifton <nickc@redhat.com>
|
2014-06-26 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* readelf.c (process_note_sections): If there are no note sections
|
* readelf.c (process_note_sections): If there are no note sections
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
-*- text -*-
|
-*- text -*-
|
||||||
|
|
||||||
|
* Add --include-all-whitespace to strings.
|
||||||
|
|
||||||
* Add --dump-section option to objcopy.
|
* Add --dump-section option to objcopy.
|
||||||
|
|
||||||
* Add support for the Andes NDS32.
|
* Add support for the Andes NDS32.
|
||||||
|
|
|
@ -2665,6 +2665,7 @@ strings [@option{-afovV}] [@option{-}@var{min-len}]
|
||||||
[@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
|
[@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
|
||||||
[@option{-}] [@option{--all}] [@option{--print-file-name}]
|
[@option{-}] [@option{--all}] [@option{--print-file-name}]
|
||||||
[@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}]
|
[@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}]
|
||||||
|
[@option{-w}] [@option{--include-all-whitespace}]
|
||||||
[@option{--help}] [@option{--version}] @var{file}@dots{}
|
[@option{--help}] [@option{--version}] @var{file}@dots{}
|
||||||
@c man end
|
@c man end
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
@ -2736,6 +2737,13 @@ Specify an object code format other than your system's default format.
|
||||||
@itemx -V
|
@itemx -V
|
||||||
@itemx --version
|
@itemx --version
|
||||||
Print the program version number on the standard output and exit.
|
Print the program version number on the standard output and exit.
|
||||||
|
|
||||||
|
@item -w
|
||||||
|
@itemx --include-all-whitespace
|
||||||
|
By default tab and space characters are included in the strings that
|
||||||
|
are displayed, but other whitespace characters, such a newlines and
|
||||||
|
carriage returns, are not. The @option{-w} option changes this so
|
||||||
|
that all whitespace characters are considered to be part of a string.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@c man end
|
@c man end
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
-t {o,x,d} Print the offset within the file before each string,
|
-t {o,x,d} Print the offset within the file before each string,
|
||||||
in octal/hex/decimal.
|
in octal/hex/decimal.
|
||||||
|
|
||||||
|
--include-all-whitespace
|
||||||
|
-w By default tab and space are the only whitepace included in graphic
|
||||||
|
char sequences. This option considers all of isspace() valid.
|
||||||
|
|
||||||
-o Like -to. (Some other implementations have -o like -to,
|
-o Like -to. (Some other implementations have -o like -to,
|
||||||
others like -td. We chose one arbitrarily.)
|
others like -td. We chose one arbitrarily.)
|
||||||
|
|
||||||
|
@ -68,7 +72,9 @@
|
||||||
#define STRING_ISGRAPHIC(c) \
|
#define STRING_ISGRAPHIC(c) \
|
||||||
( (c) >= 0 \
|
( (c) >= 0 \
|
||||||
&& (c) <= 255 \
|
&& (c) <= 255 \
|
||||||
&& ((c) == '\t' || ISPRINT (c) || (encoding == 'S' && (c) > 127)))
|
&& ((c) == '\t' || ISPRINT (c) || (encoding == 'S' && (c) > 127) \
|
||||||
|
|| (include_all_whitespace == TRUE && ISSPACE (c))) \
|
||||||
|
)
|
||||||
|
|
||||||
#ifndef errno
|
#ifndef errno
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
@ -83,6 +89,9 @@ static int address_radix;
|
||||||
/* Minimum length of sequence of graphic chars to trigger output. */
|
/* Minimum length of sequence of graphic chars to trigger output. */
|
||||||
static int string_min;
|
static int string_min;
|
||||||
|
|
||||||
|
/* Whether or not we include all whitespace as a graphic char. */
|
||||||
|
static bfd_boolean include_all_whitespace;
|
||||||
|
|
||||||
/* TRUE means print address within file for each string. */
|
/* TRUE means print address within file for each string. */
|
||||||
static bfd_boolean print_addresses;
|
static bfd_boolean print_addresses;
|
||||||
|
|
||||||
|
@ -108,6 +117,7 @@ static struct option long_options[] =
|
||||||
{"print-file-name", no_argument, NULL, 'f'},
|
{"print-file-name", no_argument, NULL, 'f'},
|
||||||
{"bytes", required_argument, NULL, 'n'},
|
{"bytes", required_argument, NULL, 'n'},
|
||||||
{"radix", required_argument, NULL, 't'},
|
{"radix", required_argument, NULL, 't'},
|
||||||
|
{"include-all-whitespace", required_argument, NULL, 'w'},
|
||||||
{"encoding", required_argument, NULL, 'e'},
|
{"encoding", required_argument, NULL, 'e'},
|
||||||
{"target", required_argument, NULL, 'T'},
|
{"target", required_argument, NULL, 'T'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
@ -154,13 +164,14 @@ main (int argc, char **argv)
|
||||||
expandargv (&argc, &argv);
|
expandargv (&argc, &argv);
|
||||||
|
|
||||||
string_min = 4;
|
string_min = 4;
|
||||||
|
include_all_whitespace = FALSE;
|
||||||
print_addresses = FALSE;
|
print_addresses = FALSE;
|
||||||
print_filenames = FALSE;
|
print_filenames = FALSE;
|
||||||
datasection_only = TRUE;
|
datasection_only = TRUE;
|
||||||
target = NULL;
|
target = NULL;
|
||||||
encoding = 's';
|
encoding = 's';
|
||||||
|
|
||||||
while ((optc = getopt_long (argc, argv, "afhHn:ot:e:T:Vv0123456789",
|
while ((optc = getopt_long (argc, argv, "afhHn:wot:e:T:Vv0123456789",
|
||||||
long_options, (int *) 0)) != EOF)
|
long_options, (int *) 0)) != EOF)
|
||||||
{
|
{
|
||||||
switch (optc)
|
switch (optc)
|
||||||
|
@ -183,6 +194,10 @@ main (int argc, char **argv)
|
||||||
fatal (_("invalid integer argument %s"), optarg);
|
fatal (_("invalid integer argument %s"), optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'w':
|
||||||
|
include_all_whitespace = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
print_addresses = TRUE;
|
print_addresses = TRUE;
|
||||||
address_radix = 8;
|
address_radix = 8;
|
||||||
|
@ -639,6 +654,7 @@ usage (FILE *stream, int status)
|
||||||
-n --bytes=[number] Locate & print any NUL-terminated sequence of at\n\
|
-n --bytes=[number] Locate & print any NUL-terminated sequence of at\n\
|
||||||
-<number> least [number] characters (default 4).\n\
|
-<number> least [number] characters (default 4).\n\
|
||||||
-t --radix={o,d,x} Print the location of the string in base 8, 10 or 16\n\
|
-t --radix={o,d,x} Print the location of the string in base 8, 10 or 16\n\
|
||||||
|
-w --include-all-whitespace Include all whitespace as valid string characters\n\
|
||||||
-o An alias for --radix=o\n\
|
-o An alias for --radix=o\n\
|
||||||
-T --target=<BFDNAME> Specify the binary file format\n\
|
-T --target=<BFDNAME> Specify the binary file format\n\
|
||||||
-e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\
|
-e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue