• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/core/techModels/libsim-panalyzer/symbol.h

00001 /*
00002  * symbol.h - program symbol and line data interfaces
00003  *
00004  * This file is a part of the SimpleScalar tool suite written by
00005  * Todd M. Austin as a part of the Multiscalar Research Project.
00006  *  
00007  * The tool suite is currently maintained by Doug Burger and Todd M. Austin.
00008  * 
00009  * Copyright (C) 1994, 1995, 1996, 1997, 1998 by Todd M. Austin
00010  *
00011  * This source file is distributed "as is" in the hope that it will be
00012  * useful.  The tool set comes with no warranty, and no author or
00013  * distributor accepts any responsibility for the consequences of its
00014  * use. 
00015  * 
00016  * Everyone is granted permission to copy, modify and redistribute
00017  * this tool set under the following conditions:
00018  * 
00019  *    This source code is distributed for non-commercial use only. 
00020  *    Please contact the maintainer for restrictions applying to 
00021  *    commercial use.
00022  *
00023  *    Permission is granted to anyone to make or distribute copies
00024  *    of this source code, either as received or modified, in any
00025  *    medium, provided that all copyright notices, permission and
00026  *    nonwarranty notices are preserved, and that the distributor
00027  *    grants the recipient permission for further redistribution as
00028  *    permitted by this document.
00029  *
00030  *    Permission is granted to distribute this file in compiled
00031  *    or executable form under the same conditions that apply for
00032  *    source code, provided that either:
00033  *
00034  *    A. it is accompanied by the corresponding machine-readable
00035  *       source code,
00036  *    B. it is accompanied by a written offer, with no time limit,
00037  *       to give anyone a machine-readable copy of the corresponding
00038  *       source code in return for reimbursement of the cost of
00039  *       distribution.  This written offer must permit verbatim
00040  *       duplication by anyone, or
00041  *    C. it is distributed by someone who received only the
00042  *       executable form, and is accompanied by a copy of the
00043  *       written offer of source code that they received concurrently.
00044  *
00045  * In other words, you are welcome to use, share and improve this
00046  * source file.  You are forbidden to forbid anyone else to use, share
00047  * and improve what you give them.
00048  *
00049  * INTERNET: dburger@cs.wisc.edu
00050  * US Mail:  1210 W. Dayton Street, Madison, WI 53706
00051  *
00052  * $Id: symbol.h,v 1.1.1.1 2003/09/18 00:57:54 panalyzer Exp $
00053  *
00054  * $Log: symbol.h,v $
00055  * Revision 1.1.1.1  2003/09/18 00:57:54  panalyzer
00056  *
00057  *
00058  * Revision 1.1.1.1  2003/09/18 00:18:44  panalyzer
00059  *
00060  *
00061  * Revision 1.1.1.1  2003/09/16 18:48:14  gdm
00062  *
00063  *
00064  * Revision 1.1.1.1  2000/11/29 14:53:54  cu-cs
00065  * Grand unification of arm sources.
00066  *
00067  *
00068  * Revision 1.1.1.1  2000/05/26 15:18:58  taustin
00069  * SimpleScalar Tool Set
00070  *
00071  *
00072  * Revision 1.2  1998/08/27 16:45:17  taustin
00073  * implemented host interface description in host.h
00074  * added target interface support
00075  * moved target-dependent definitions to target files
00076  * added support for register and memory contexts
00077  *
00078  * Revision 1.1  1997/03/11  01:34:37  taustin
00079  * Initial revision
00080  *
00081  *
00082  */
00083 
00084 #ifndef SYMBOL_H
00085 #define SYMBOL_H
00086 
00087 #include <stdio.h>
00088 
00089 #include "host.h"
00090 #include "misc.h"
00091 #include "machine.h"
00092 
00093 enum sym_seg_t {
00094   ss_data,                      /* data segment symbol */
00095   ss_text,                      /* text segment symbol */
00096   ss_NUM
00097 };
00098 
00099 /* internal program symbol format */
00100 struct sym_sym_t {
00101   char *name;                   /* symbol name */
00102   enum sym_seg_t seg;           /* symbol segment */
00103   int initialized;              /* initialized? (if data segment) */
00104   int pub;                      /* externally visible? */
00105   int local;                    /* compiler local symbol? */
00106   md_addr_t addr;               /* symbol address value */
00107   int size;                     /* bytes to next symbol */
00108 };
00109 
00110 /* symbol database in no particular order */
00111 extern struct sym_sym_t *sym_db;
00112 
00113 /* all symbol sorted by address */
00114 extern int sym_nsyms;
00115 extern struct sym_sym_t **sym_syms;
00116 
00117 /* all symbols sorted by name */
00118 extern struct sym_sym_t **sym_syms_by_name;
00119 
00120 /* text symbols sorted by address */
00121 extern int sym_ntextsyms;
00122 extern struct sym_sym_t **sym_textsyms;
00123 
00124 /* text symbols sorted by name */
00125 extern struct sym_sym_t **sym_textsyms_by_name;
00126 
00127 /* data symbols sorted by address */
00128 extern int sym_ndatasyms;
00129 extern struct sym_sym_t **sym_datasyms;
00130 
00131 /* data symbols sorted by name */
00132 extern struct sym_sym_t **sym_datasyms_by_name;
00133 
00134 /* load symbols out of FNAME */
00135 void
00136 sym_loadsyms(char *fname,               /* file name containing symbols */
00137              int load_locals);          /* load local symbols */
00138 
00139 /* dump symbol SYM to output stream FD */
00140 void
00141 sym_dumpsym(struct sym_sym_t *sym,      /* symbol to display */
00142             FILE *fd);                  /* output stream */
00143 
00144 /* dump all symbols to output stream FD */
00145 void
00146 sym_dumpsyms(FILE *fd);                 /* output stream */
00147 
00148 /* dump all symbol state to output stream FD */
00149 void
00150 sym_dumpstate(FILE *fd);                /* output stream */
00151 
00152 /* symbol databases available */
00153 enum sym_db_t {
00154   sdb_any,                      /* search all symbols */
00155   sdb_text,                     /* search text symbols */
00156   sdb_data,                     /* search data symbols */
00157   sdb_NUM
00158 };
00159 
00160 /* bind address ADDR to a symbol in symbol database DB, the address must
00161    match exactly if EXACT is non-zero, the index of the symbol in the
00162    requested symbol database is returned in *PINDEX if the pointer is
00163    non-NULL */
00164 struct sym_sym_t *                      /* symbol found, or NULL */
00165 sym_bind_addr(md_addr_t addr,           /* address of symbol to locate */
00166               int *pindex,              /* ptr to index result var */
00167               int exact,                /* require exact address match? */
00168               enum sym_db_t db);        /* symbol database to search */
00169 
00170 /* bind name NAME to a symbol in symbol database DB, the index of the symbol
00171    in the requested symbol database is returned in *PINDEX if the pointer is
00172    non-NULL */
00173 struct sym_sym_t *                              /* symbol found, or NULL */
00174 sym_bind_name(char *name,                       /* symbol name to locate */
00175               int *pindex,                      /* ptr to index result var */
00176               enum sym_db_t db);                /* symbol database to search */
00177 
00178 #endif /* SYMBOL_H */
00179 

Generated on Fri Oct 22 2010 11:02:21 for SST by  doxygen 1.7.1