GDB (API)
/home/stan/gdb/src/gdb/source.h
Go to the documentation of this file.
00001 /* List lines of source files for GDB, the GNU debugger.
00002    Copyright (C) 1999-2013 Free Software Foundation, Inc.
00003 
00004    This file is part of GDB.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #ifndef SOURCE_H
00020 #define SOURCE_H
00021 
00022 struct symtab;
00023 
00024 /* This function is capable of finding the absolute path to a
00025    source file, and opening it, provided you give it a FILENAME.  Both the
00026    DIRNAME and FULLNAME are only added suggestions on where to find the file.
00027 
00028    FILENAME should be the filename to open.
00029    DIRNAME is the compilation directory of a particular source file.
00030            Only some debug formats provide this info.
00031    FULLNAME can be the last known absolute path to the file in question.
00032      Space for the path must have been malloc'd.  If a path substitution
00033      is applied we free the old value and set a new one.
00034 
00035    On Success
00036      A valid file descriptor is returned (the return value is positive).
00037      FULLNAME is set to the absolute path to the file just opened.
00038      The caller is responsible for freeing FULLNAME.
00039 
00040    On Failure
00041      An invalid file descriptor is returned (the return value is negative).
00042      FULLNAME is set to NULL.  */
00043 extern int find_and_open_source (const char *filename,
00044                                  const char *dirname,
00045                                  char **fullname);
00046 
00047 /* Open a source file given a symtab S.  Returns a file descriptor or
00048    negative number for error.  */
00049 extern int open_source_file (struct symtab *s);
00050 
00051 extern char *rewrite_source_path (const char *path);
00052 
00053 extern const char *symtab_to_fullname (struct symtab *s);
00054 
00055 /* Returns filename without the compile directory part, basename or absolute
00056    filename.  It depends on 'set filename-display' value.  */
00057 extern const char *symtab_to_filename_for_display (struct symtab *symtab);
00058 
00059 /* Create and initialize the table S->line_charpos that records the
00060    positions of the lines in the source file, which is assumed to be
00061    open on descriptor DESC.  All set S->nlines to the number of such
00062    lines.  */
00063 extern void find_source_lines (struct symtab *s, int desc);
00064 
00065 /* Return the first line listed by print_source_lines.
00066    Used by command interpreters to request listing from
00067    a previous point.  */
00068 extern int get_first_line_listed (void);
00069 
00070 /* Return the default number of lines to print with commands like the
00071    cli "list".  The caller of print_source_lines must use this to
00072    calculate the end line and use it in the call to print_source_lines
00073    as it does not automatically use this value.  */
00074 extern int get_lines_to_list (void);
00075 
00076 /* Return the current source file for listing and next line to list.
00077    NOTE: The returned sal pc and end fields are not valid.  */
00078 extern struct symtab_and_line get_current_source_symtab_and_line (void);
00079 
00080 /* If the current source file for listing is not set, try and get a default.
00081    Usually called before get_current_source_symtab_and_line() is called.
00082    It may err out if a default cannot be determined.
00083    We must be cautious about where it is called, as it can recurse as the
00084    process of determining a new default may call the caller!
00085    Use get_current_source_symtab_and_line only to get whatever
00086    we have without erroring out or trying to get a default.  */
00087 extern void set_default_source_symtab_and_line (void);
00088 
00089 /* Return the current default file for listing and next line to list
00090    (the returned sal pc and end fields are not valid.)
00091    and set the current default to whatever is in SAL.
00092    NOTE: The returned sal pc and end fields are not valid.  */
00093 extern struct symtab_and_line set_current_source_symtab_and_line (const struct symtab_and_line *);
00094 
00095 /* Reset any information stored about a default file and line to print.  */
00096 extern void clear_current_source_symtab_and_line (void);
00097 
00098 /* Add a source path substitution rule.  */
00099 extern void add_substitute_path_rule (char *, char *);
00100 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines