aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-07-17 20:08:48 +0100
committerPedro Alves <palves@redhat.com>2017-07-17 20:08:48 +0100
commit1d550c828c00978860de9ba35b9ab5b182b968bc (patch)
tree954214a0143cabe168cbd44c3480eec62604f215 /gdb/utils.h
parentdd57c19c1abd19c71538631cd9e5b0f70eff5a5c (diff)
downloadgdb-1d550c828c00978860de9ba35b9ab5b182b968bc.zip
gdb-1d550c828c00978860de9ba35b9ab5b182b968bc.tar.gz
gdb-1d550c828c00978860de9ba35b9ab5b182b968bc.tar.bz2
Introduce strncmp_iw
The explicit locations completer patch will need a strncmp_iw function, that to strcmp_iw like strncmp is to strcmp. This patch implements it. (Unit tests added a bit further down in this series will exercise this.) gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * utils.c (enum class strncmp_iw_mode): New. (strcmp_iw): Rename to ... (strncmp_iw_with_mode): ... this. Add string2_len and mode parameters. Handle them. (strncmp_iw): New. (strcmp_iw): Reimplement as wrapper around strncmp_iw_with_mode. * utils.h (strncmp_iw): Declare. (strcmp_iw): Move describing comments here.
Diffstat (limited to 'gdb/utils.h')
-rw-r--r--gdb/utils.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/utils.h b/gdb/utils.h
index 3347c23..6df752f 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -31,7 +31,24 @@ extern void initialize_utils (void);
extern int sevenbit_strings;
-extern int strcmp_iw (const char *, const char *);
+/* Do a strncmp() type operation on STRING1 and STRING2, ignoring any
+ differences in whitespace. STRING2_LEN is STRING2's length.
+ Returns 0 if STRING1 matches STRING2_LEN characters of STRING2,
+ non-zero otherwise (slightly different than strncmp()'s range of
+ return values). */
+extern int strncmp_iw (const char *string1, const char *string2,
+ size_t string2_len);
+
+/* Do a strcmp() type operation on STRING1 and STRING2, ignoring any
+ differences in whitespace. Returns 0 if they match, non-zero if
+ they don't (slightly different than strcmp()'s range of return
+ values).
+
+ As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO".
+ This "feature" is useful when searching for matching C++ function
+ names (such as if the user types 'break FOO', where FOO is a
+ mangled C++ function). */
+extern int strcmp_iw (const char *string1, const char *string2);
extern int strcmp_iw_ordered (const char *, const char *);