1b725ae77Skettenis /* List lines of source files for GDB, the GNU debugger. 2b725ae77Skettenis Copyright 1999 Free Software Foundation, Inc. 3b725ae77Skettenis 4b725ae77Skettenis This file is part of GDB. 5b725ae77Skettenis 6b725ae77Skettenis This program is free software; you can redistribute it and/or modify 7b725ae77Skettenis it under the terms of the GNU General Public License as published by 8b725ae77Skettenis the Free Software Foundation; either version 2 of the License, or 9b725ae77Skettenis (at your option) any later version. 10b725ae77Skettenis 11b725ae77Skettenis This program is distributed in the hope that it will be useful, 12b725ae77Skettenis but WITHOUT ANY WARRANTY; without even the implied warranty of 13b725ae77Skettenis MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14b725ae77Skettenis GNU General Public License for more details. 15b725ae77Skettenis 16b725ae77Skettenis You should have received a copy of the GNU General Public License 17b725ae77Skettenis along with this program; if not, write to the Free Software 18b725ae77Skettenis Foundation, Inc., 59 Temple Place - Suite 330, 19b725ae77Skettenis Boston, MA 02111-1307, USA. */ 20b725ae77Skettenis 21b725ae77Skettenis #ifndef SOURCE_H 22b725ae77Skettenis #define SOURCE_H 23b725ae77Skettenis 24b725ae77Skettenis struct symtab; 25b725ae77Skettenis 26b725ae77Skettenis /* Open a source file given a symtab S. Returns a file descriptor or 27b725ae77Skettenis negative number for error. */ 28b725ae77Skettenis extern int open_source_file (struct symtab *s); 29b725ae77Skettenis 30*11efff7fSkettenis extern char* psymtab_to_fullname (struct partial_symtab *ps); 31*11efff7fSkettenis extern char* symtab_to_fullname (struct symtab *s); 32*11efff7fSkettenis 33b725ae77Skettenis /* Create and initialize the table S->line_charpos that records the 34b725ae77Skettenis positions of the lines in the source file, which is assumed to be 35b725ae77Skettenis open on descriptor DESC. All set S->nlines to the number of such 36b725ae77Skettenis lines. */ 37b725ae77Skettenis extern void find_source_lines (struct symtab *s, int desc); 38b725ae77Skettenis 39b725ae77Skettenis /* Return the first line listed by print_source_lines. 40b725ae77Skettenis Used by command interpreters to request listing from 41b725ae77Skettenis a previous point. */ 42b725ae77Skettenis extern int get_first_line_listed (void); 43b725ae77Skettenis 44b725ae77Skettenis /* Return the default number of lines to print with commands like the 45b725ae77Skettenis cli "list". The caller of print_source_lines must use this to 46b725ae77Skettenis calculate the end line and use it in the call to print_source_lines 47b725ae77Skettenis as it does not automatically use this value. */ 48b725ae77Skettenis extern int get_lines_to_list (void); 49b725ae77Skettenis 50b725ae77Skettenis /* Return the current source file for listing and next line to list. 51b725ae77Skettenis NOTE: The returned sal pc and end fields are not valid. */ 52b725ae77Skettenis extern struct symtab_and_line get_current_source_symtab_and_line (void); 53b725ae77Skettenis 54b725ae77Skettenis /* If the current source file for listing is not set, try and get a default. 55b725ae77Skettenis Usually called before get_current_source_symtab_and_line() is called. 56b725ae77Skettenis It may err out if a default cannot be determined. 57b725ae77Skettenis We must be cautious about where it is called, as it can recurse as the 58b725ae77Skettenis process of determining a new default may call the caller! 59b725ae77Skettenis Use get_current_source_symtab_and_line only to get whatever 60b725ae77Skettenis we have without erroring out or trying to get a default. */ 61b725ae77Skettenis extern void set_default_source_symtab_and_line (void); 62b725ae77Skettenis 63b725ae77Skettenis /* Return the current default file for listing and next line to list 64b725ae77Skettenis (the returned sal pc and end fields are not valid.) 65b725ae77Skettenis and set the current default to whatever is in SAL. 66b725ae77Skettenis NOTE: The returned sal pc and end fields are not valid. */ 67b725ae77Skettenis extern struct symtab_and_line set_current_source_symtab_and_line (const struct symtab_and_line *); 68b725ae77Skettenis 69b725ae77Skettenis /* Reset any information stored about a default file and line to print. */ 70b725ae77Skettenis extern void clear_current_source_symtab_and_line (void); 71b725ae77Skettenis #endif 72