create new tag
view all tags

Source browsing using emacs and etags

To work on the code the first time

  • Use C-x 2 or C-x 3 to split the windows into sub-windows vertically or horizontally
  • Use C-x C-f to open a file
  • Use "etags -R *" in command line to get the TAGS file for browsing the code
  • Use M-. to find the definition for a symbol (variable or function and so on) and use M-* to jump back
  • C-u M-. to find remaining ones
  • M-x tags-apropos to list all tages that match REGEXP
  • Use grep symbol_string * -n to find all occurrences of symbol_string in the current directory

You don't need to re-generate the tags each time starting emacs. Below is how to generate the tags through the command line and then load them when needed.

  • generate the tags
    • the basic syntax is etags input_files, the tag table is in TAGS
    • if you have many files in sub-directories you can use
      • find . -name "*.[chCH]" -print | etags -
    • if you use absolute file names, then you can move the TAGS file to another directory
  • loading the tag table
    • M-x visit-tags-table
    • to load a table automatically when starting emacs
      • (setq tags-table-list '("file_path"))

See the following for more information

  • man/info etags
  • info emacs, search for tags
  • etags --help gives the list of options including default suffixes for languages

Debugging using emacs and gdb

  • M-x gdb file_name
  • use break [file:]func_name to set a break point
    • break [filename:]linenum to stop at a line
    • break ... if cond to stop only when cond evaluates to true
    • info break to print all breakpoints
  • for other commands see Debugging with GDB by Stallman, Pesch, Shebs, et al.
    • you can set watchpoints and disable, enble or delete these points.
    • you can examine the stack and data and change the value of variables
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2008-01-29 - ChenDing
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback