Update find command help and search memory docs
authorDominik Czarnota <dominik.b.czarnota@gmail.com>
Mon, 27 Nov 2017 03:42:18 +0000 (22:42 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 27 Nov 2017 03:42:19 +0000 (22:42 -0500)
This patch updates the `find` command help and docs description to show
how to search for not null terminated strings when current language's
strings includes it.

gdb/ChangeLog:

PR gdb/21945
* findcmd.c (_initialize_mem_search): Update find command help
text.

gdb/doc/ChangeLog:

PR gdb/21945
* gdb.texinfo (Search Memory): Update description and example
about how to search a string without NULL terminator.

gdb/ChangeLog
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/findcmd.c

index b3032ed7d88e4de73279cdbd927617296a7727c4..6134efc09cab178920c5cf6d2960511d30b6a792 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-26  Dominik Czarnota  <dominik.b.czarnota@gmail.com>
+
+       PR gdb/21945
+       * findcmd.c (_initialize_mem_search): Update find command help
+       text.
+
 2017-11-26  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * python/python.c (do_start_initialization): Change progname
index 988b7b8d87231ff435350db144aee63261a199cd..2a1eb76d15c759e6bd3460f5a1a781ab95b7ebcb 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-26  Dominik Czarnota  <dominik.b.czarnota@gmail.com>
+
+       PR gdb/21945
+       * gdb.texinfo (Search Memory): Update description and example
+       about how to search a string without NULL terminator.
+
 2017-11-24  Joel Brobecker  <brobecker@adacore.com>
 
        * gdb.texinfo (GDB/MI Ada Exception Information): Document
index 00451d243d5baea361dda2266e20c9661306729f..675f6e7bc822a41e74f42ebcc07a5dc2c9cc5c19 100644 (file)
@@ -11920,6 +11920,8 @@ giant words (eight bytes)
 All values are interpreted in the current language.
 This means, for example, that if the current source language is C/C@t{++}
 then searching for the string ``hello'' includes the trailing '\0'.
+The null terminator can be removed from searching by using casts,
+e.g.: @samp{@{char[5]@}"hello"}.
 
 If the value size is not specified, it is taken from the
 value's type in the current language.
@@ -11969,7 +11971,11 @@ you get during debugging:
 (gdb) find &hello[0], +sizeof(hello), 'h', 'e', 'l', 'l', 'o'
 0x8049567 <hello.1620>
 0x804956d <hello.1620+6>
-2 patterns found
+2 patterns found.
+(gdb) find &hello[0], +sizeof(hello), @{char[5]@}"hello"
+0x8049567 <hello.1620>
+0x804956d <hello.1620+6>
+2 patterns found.
 (gdb) find /b1 &hello[0], +sizeof(hello), 'h', 0x65, 'l'
 0x8049567 <hello.1620>
 1 pattern found
index b43fefc06daac63aa854231c27d5fbec5b00368e..d437b56d9203389055d0145b06a73d4e1709d82c 100644 (file)
@@ -293,7 +293,9 @@ and if not specified the size is taken from the type of the expression\n\
 in the current language.\n\
 Note that this means for example that in the case of C-like languages\n\
 a search for an untyped 0x42 will search for \"(int) 0x42\"\n\
-which is typically four bytes.\n\
+which is typically four bytes, and a search for a string \"hello\" will\n\
+include the trailing '\\0'.  The null terminator can be removed from\n\
+searching by using casts, e.g.: {char[5]}\"hello\".\n\
 \n\
 The address of the last match is stored as the value of \"$_\".\n\
 Convenience variable \"$numfound\" is set to the number of matches."),
This page took 0.059597 seconds and 4 git commands to generate.