The following search commands search through the current source file for a specified character string:
GDB Mode
search_source_file_command
: forward-search [ string ]
| reverse-search [ string ]
DBX Mode
search_source_file_command
The search string is taken as all the rest of the line, so you do not need to quote the string. Alias expansion will be done on the rest of the line before the search, possibly changing the search string.
Use a slash (/) to search forward from the most recently listed line; use a question mark (?) to search backward. The search will stop at the end (or beginning) of the file being searched, and will wrap if the command is repeated at that point.
When the string is omitted, the previous search continues from where it found the string. When the string is present, the search starts from either the start (/) or the end (?) of the current line.
When a match is found, the debugger lists the line number and the line. That line becomes the starting point for any further searches, or for a list command. For example:
To locate _firstNode:
GDB Mode
(idb) forward-search _firstNode
69 NODETYPE* _firstNode;
DBX Mode
(idb) /_firstNode
69 NODETYPE* _firstNode;
Then to locate append before line 69:
GDB Mode
(idb) reverse-search append
65 void append (NODETYPE* const node);
DBX Mode
(idb) ?append
65 void append (NODETYPE* const node);
Then to locate append after line 65:
GDB Mode
(idb) forward-search append
145 void List<NODETYPE>::append(NODETYPE* const node)
DBX Mode
(idb) /append
145 void List<NODETYPE>::append(NODETYPE* const node)
The debugger provides parameterized aliases and debugger variables of arbitrary types. You can use these to do list traversal (see Array Navigation Example).