4

I have a file that is several thousand lines long opened in TUI mode of gdb. I would like to search the file for a variable, is that possible? Because the file is long, I am really trying to avoid hunting for the word manually.

The Vivandiere
  • 3,059
  • 3
  • 28
  • 50

1 Answers1

1

There are no TUI specific search commands defined in manual. And gdb is debugger, not code navigation tool (use ctags/cscope/lxr/source navigator; or use IDE with debugger and with code navigator).

Try to use gdb (non-TUI) command, but it will work only for one next location (I see no "next search" here):

https://sourceware.org/gdb/onlinedocs/gdb/Search.html#Search

There are two commands for searching through the current source file for a regular expression.

forward-search regexp
search regexp

The command ‘forward-search regexp’ checks each line, starting with the one following the last line listed, for a match for regexp. It lists the line that is found. You can use the synonym ‘search regexp’ or abbreviate the command name as fo.

reverse-search regexp

The command ‘reverse-search regexp’ checks each line, starting with the one before the last line listed and going backward, for a match for regexp. It lists the line that is found. You can abbreviate this command as rev.

You can also use list commands to change lines displayed in TUI source window - https://sourceware.org/gdb/onlinedocs/gdb/List.html#List

osgx
  • 90,338
  • 53
  • 357
  • 513