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