Example
$ cat example.c #include <stdio.h> #include <stdlib.h>
int main()
{
char *str;
str = (char *) malloc (15);
}
(gdb) find &str[0], &str[15], "hi" 0x400123e0
0x400123e2
0x400123e5
3 patterns found.
(gdb) find/2 &str[0], &str[15], "hi" 0x400123e0
0x400123e2
2 patterns found.
(gdb) find/2b &str[0], &str[15], 0x68 0x400123e0
0x400123e2
2 patterns found.
(gdb) find/2b &str[0], +10, 0x68 0x400123e0
0x400123e2
2 patterns found.
(gdb) find/2b &str[0], +10, 0x68, 0x69 0x400123e0
0x400123e2
2 patterns found.
(gdb) find &str[0], &str[15], "hi", "hi" 0x400123e0
1 pattern found.
The following examples provide sample usages of the different parameters in the find command:
•Using the start address
(gdb) find &a[0], &a[10], "el",'l' 2 patterns found.
198