"I am a person who works hard and plays hard."

Yuan Wei
Second Year Graduate Student Department of Computer Science
University of Virginia Charlottesville, VA 22903
Email: yw3f@cs.virginia.edu


Source Code Analysis

Main Page   Compound List   File List   Compound Members   File Members  

ptrace.h File Reference

#include "host.h"
#include "misc.h"
#include "machine.h"
#include "range.h"

Include dependency graph for ptrace.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

Functions

Variables


Define Documentation

#define PEV_AGEN   0x00000010
 

Definition at line 106 of file ptrace.h.

Referenced by ruu_issue().

#define PEV_CACHEMISS   0x00000001
 

Definition at line 102 of file ptrace.h.

Referenced by ruu_commit(), and ruu_issue().

#define PEV_MPDETECT   0x00000008
 

Definition at line 105 of file ptrace.h.

Referenced by ruu_writeback().

#define PEV_MPOCCURED   0x00000004
 

Definition at line 104 of file ptrace.h.

Referenced by ruu_dispatch().

#define PEV_TLBMISS   0x00000002
 

Definition at line 103 of file ptrace.h.

Referenced by ruu_commit(), and ruu_issue().

#define PST_COMMIT   "CT"
 

Definition at line 99 of file ptrace.h.

Referenced by ruu_commit().

#define PST_DISPATCH   "DA"
 

Definition at line 96 of file ptrace.h.

Referenced by ruu_dispatch().

#define PST_EXECUTE   "EX"
 

Definition at line 97 of file ptrace.h.

Referenced by ruu_issue().

#define PST_IFETCH   "IF"
 

Definition at line 95 of file ptrace.h.

#define PST_WRITEBACK   "WB"
 

Definition at line 98 of file ptrace.h.

Referenced by ruu_issue(), and ruu_writeback().

#define ptrace_active A,
I,
     (ptrace_outfd != NULL && !range_cmp_range(&ptrace_range, (A), (I), (C)))
 

Definition at line 149 of file ptrace.h.

#define ptrace_check_active PC,
ICNT,
CYCLE   
 

Value:

((ptrace_outfd != NULL                                          \
    && !range_cmp_range1(&ptrace_range, (PC), (ICNT), (CYCLE)))         \
   ? (!ptrace_oneshot ? (ptrace_active = ptrace_oneshot = TRUE) : FALSE)\
   : (ptrace_active = FALSE))

Definition at line 131 of file ptrace.h.

#define ptrace_endinst      if (ptrace_active) __ptrace_endinst((A))
 

Definition at line 142 of file ptrace.h.

Referenced by ruu_commit(), ruu_dispatch(), ruu_recover(), and tracer_recover().

#define ptrace_newcycle      if (ptrace_active) __ptrace_newcycle((A))
 

Definition at line 144 of file ptrace.h.

#define ptrace_newinst A,
B,
C,
D       if (ptrace_active) __ptrace_newinst((A),(B),(C),(D))
 

Definition at line 138 of file ptrace.h.

#define ptrace_newstage A,
B,
     if (ptrace_active) __ptrace_newstage((A),(B),(C))
 

Definition at line 146 of file ptrace.h.

Referenced by ruu_commit(), ruu_dispatch(), ruu_issue(), and ruu_writeback().

#define ptrace_newuop A,
B,
C,
D       if (ptrace_active) __ptrace_newuop((A),(B),(C),(D))
 

Definition at line 140 of file ptrace.h.

Referenced by ruu_dispatch().


Function Documentation

void __ptrace_endinst unsigned int    iseq
 

Definition at line 170 of file ptrace.c.

References ptrace_outfd.

00171 {
00172   fprintf(ptrace_outfd, "- %u\n", iseq);
00173 
00174   if (ptrace_outfd == stderr || ptrace_outfd == stdout)
00175     fflush(ptrace_outfd);
00176 }

void __ptrace_newcycle tick_t    cycle
 

Definition at line 180 of file ptrace.c.

References ptrace_outfd, and tick_t.

00181 {
00182   fprintf(ptrace_outfd, "@ %.0f\n", (double)cycle);
00183 
00184   if (ptrace_outfd == stderr || ptrace_outfd == stdout)
00185     fflush(ptrace_outfd);
00186 }

void __ptrace_newinst unsigned int    iseq,
md_inst_t    inst,
md_addr_t    pc,
md_addr_t    addr
 

Definition at line 141 of file ptrace.c.

References md_print_insn(), myfprintf(), and ptrace_outfd.

00145 {
00146   myfprintf(ptrace_outfd, "+ %u 0x%08p 0x%08p ", iseq, pc, addr);
00147   md_print_insn(inst, addr, ptrace_outfd);
00148   fprintf(ptrace_outfd, "\n");
00149 
00150   if (ptrace_outfd == stderr || ptrace_outfd == stdout)
00151     fflush(ptrace_outfd);
00152 }

void __ptrace_newstage unsigned int    iseq,
char *    pstage,
unsigned int    pevents
 

Definition at line 190 of file ptrace.c.

References ptrace_outfd.

00193 {
00194   fprintf(ptrace_outfd, "* %u %s 0x%08x\n", iseq, pstage, pevents);
00195 
00196   if (ptrace_outfd == stderr || ptrace_outfd == stdout)
00197     fflush(ptrace_outfd);
00198 }

void __ptrace_newuop unsigned int    iseq,
char *    uop_desc,
md_addr_t    pc,
md_addr_t    addr
 

Definition at line 156 of file ptrace.c.

References myfprintf(), and ptrace_outfd.

00160 {
00161   myfprintf(ptrace_outfd,
00162             "+ %u 0x%08p 0x%08p [%s]\n", iseq, pc, addr, uop_desc);
00163 
00164   if (ptrace_outfd == stderr || ptrace_outfd == stdout)
00165     fflush(ptrace_outfd);
00166 }

void ptrace_close void   
 

Definition at line 133 of file ptrace.c.

References ptrace_outfd.

Referenced by sim_uninit().

00134 {
00135   if (ptrace_outfd != NULL && ptrace_outfd != stderr && ptrace_outfd != stdout)
00136     fclose(ptrace_outfd);
00137 }

void ptrace_open char *    range,
char *    fname
 

Definition at line 93 of file ptrace.c.

References range_range_t::end, FALSE, fatal(), panic(), ptrace_active, ptrace_outfd, range_pos_t::ptype, range_parse_range(), range_range_t::start, and TRUE.

Referenced by sim_load_prog().

00095 {
00096   char *errstr;
00097 
00098   /* parse the output range */
00099   if (!range)
00100     {
00101       /* no range */
00102       errstr = range_parse_range(":", &ptrace_range);
00103       if (errstr)
00104         panic("cannot parse pipetrace range, use: {<start>}:{<end>}");
00105       ptrace_active = TRUE;
00106     }
00107   else
00108     {
00109       errstr = range_parse_range(range, &ptrace_range);
00110       if (errstr)
00111         fatal("cannot parse pipetrace range, use: {<start>}:{<end>}");
00112       ptrace_active = FALSE;
00113     }
00114 
00115   if (ptrace_range.start.ptype != ptrace_range.end.ptype)
00116     fatal("range endpoints are not of the same type");
00117 
00118   /* open output trace file */
00119   if (!fname || !strcmp(fname, "-") || !strcmp(fname, "stderr"))
00120     ptrace_outfd = stderr;
00121   else if (!strcmp(fname, "stdout"))
00122     ptrace_outfd = stdout;
00123   else
00124     {
00125       ptrace_outfd = fopen(fname, "w");
00126       if (!ptrace_outfd)
00127         fatal("cannot open pipetrace output file `%s'", fname);
00128     }
00129 }


Variable Documentation

int ptrace_active
 

Definition at line 112 of file ptrace.h.

Referenced by ptrace_open().

int ptrace_oneshot
 

Definition at line 118 of file ptrace.h.

FILE* ptrace_outfd
 

Definition at line 109 of file ptrace.h.

Referenced by __ptrace_endinst(), __ptrace_newcycle(), __ptrace_newinst(), __ptrace_newstage(), __ptrace_newuop(), ptrace_close(), and ptrace_open().

struct range_range_t ptrace_range
 

Definition at line 115 of file ptrace.h.



UVa CS Department of Computer Science
School of Engineering, University of Virginia
151 Engineer's Way, P.O. Box 400740
Charlottesville, Virginia 22904-4740

(434) 982-2200  Fax: (434) 982-2214