xref: /dflybsd-src/contrib/binutils-2.34/gprof/source.h (revision b52ef7118d1621abed722c5bbbd542210290ecef)
1*fae548d3Szrj /* source.h
2*fae548d3Szrj 
3*fae548d3Szrj    Copyright (C) 2000-2020 Free Software Foundation, Inc.
4*fae548d3Szrj 
5*fae548d3Szrj    This file is part of GNU Binutils.
6*fae548d3Szrj 
7*fae548d3Szrj    This program is free software; you can redistribute it and/or modify
8*fae548d3Szrj    it under the terms of the GNU General Public License as published by
9*fae548d3Szrj    the Free Software Foundation; either version 3 of the License, or
10*fae548d3Szrj    (at your option) any later version.
11*fae548d3Szrj 
12*fae548d3Szrj    This program is distributed in the hope that it will be useful,
13*fae548d3Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*fae548d3Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*fae548d3Szrj    GNU General Public License for more details.
16*fae548d3Szrj 
17*fae548d3Szrj    You should have received a copy of the GNU General Public License
18*fae548d3Szrj    along with this program; if not, write to the Free Software
19*fae548d3Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20*fae548d3Szrj    MA 02110-1301, USA.  */
21*fae548d3Szrj 
22*fae548d3Szrj #ifndef source_h
23*fae548d3Szrj #define source_h
24*fae548d3Szrj 
25*fae548d3Szrj typedef struct source_file
26*fae548d3Szrj   {
27*fae548d3Szrj     struct source_file *next;
28*fae548d3Szrj     const char *name;		/* Name of source file.  */
29*fae548d3Szrj     unsigned long ncalls;	/* # of "calls" to this file.  */
30*fae548d3Szrj     int num_lines;		/* # of lines in file.  */
31*fae548d3Szrj     int nalloced;		/* Number of lines allocated.  */
32*fae548d3Szrj     void **line;		/* Usage-dependent per-line data.  */
33*fae548d3Szrj   }
34*fae548d3Szrj Source_File;
35*fae548d3Szrj 
36*fae548d3Szrj /* Options.  */
37*fae548d3Szrj 
38*fae548d3Szrj /* Create annotated output files?  */
39*fae548d3Szrj extern bfd_boolean create_annotation_files;
40*fae548d3Szrj 
41*fae548d3Szrj /* List of directories to search for source files.  */
42*fae548d3Szrj extern Search_List src_search_list;
43*fae548d3Szrj 
44*fae548d3Szrj /* Chain of source-file descriptors.  */
45*fae548d3Szrj extern Source_File *first_src_file;
46*fae548d3Szrj 
47*fae548d3Szrj /* Returns pointer to source file descriptor for PATH/FILENAME.  */
48*fae548d3Szrj extern Source_File *source_file_lookup_path (const char *);
49*fae548d3Szrj extern Source_File *source_file_lookup_name (const char *);
50*fae548d3Szrj 
51*fae548d3Szrj /* Read source file SF output annotated source.  The annotation is at
52*fae548d3Szrj    MAX_WIDTH characters wide and for each source-line an annotation is
53*fae548d3Szrj    obtained by invoking function ANNOTE.  ARG is an argument passed to
54*fae548d3Szrj    ANNOTE that is left uninterpreted by annotate_source().
55*fae548d3Szrj 
56*fae548d3Szrj    Returns a pointer to the output file (which maybe stdout) such
57*fae548d3Szrj    that summary statistics can be printed.  If the returned file
58*fae548d3Szrj    is not stdout, it should be closed when done with it.  */
59*fae548d3Szrj extern FILE *annotate_source
60*fae548d3Szrj   (Source_File *sf, unsigned int max_width,
61*fae548d3Szrj 	   void (*annote) (char *, unsigned int, int, PTR arg),
62*fae548d3Szrj 	   PTR arg);
63*fae548d3Szrj #endif /* source_h */
64