"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  

misc.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>

Include dependency graph for misc.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 FALSE   0
 

Definition at line 110 of file misc.h.

Referenced by __check_break(), __opt_process_options(), bind_to_enum(), bpred_lookup(), cache_probe(), delete_break(), dlite_cont(), dlite_dis(), dlite_display(), dlite_dsymbols(), dlite_dump(), dlite_main(), dlite_mem_obj(), dlite_options(), dlite_status(), dlite_symbol(), dlite_symbols(), dlite_tsymbols(), dump_config(), eio_read_trace(), eio_valid(), eio_write_trace(), eventq_dump(), eventq_execute(), eventq_remove(), exo_print(), f_eq_zero(), fast_SRA(), fast_SRL(), get_next_token(), ident_evaluator(), intern_escape(), ld_load_prog(), main(), opt_reg_double(), opt_reg_enum(), opt_reg_flag(), opt_reg_float(), opt_reg_int(), opt_reg_string(), opt_reg_uint(), orphan_fn(), ptrace_open(), range_parse_pos(), res_create_pool(), ruu_dispatch(), ruu_issue(), ruu_link_idep(), sim_aux_stats(), sim_check_options(), sim_main(), sim_reg_options(), simoo_mem_obj(), sym_loadsyms(), sys_syscall(), tracer_init(), and tracer_recover().

#define LLHIGH L       ((int)(((L)>>32) & 0xffffffff))
 

Definition at line 122 of file misc.h.

#define LLLOW L       ((int)((L) & 0xffffffff))
 

Definition at line 123 of file misc.h.

#define MAX a,
     (((a) < (b)) ? (b) : (a))
 

Definition at line 115 of file misc.h.

Referenced by cache_access(), cheetah_mstate_obj(), print_dist(), print_sdist(), ruu_issue(), sim_print_stats(), and sym_bind_addr().

#define MIN a,
     (((a) < (b)) ? (a) : (b))
 

Definition at line 118 of file misc.h.

#define N_ELT ARR       (sizeof(ARR)/sizeof((ARR)[0]))
 

Definition at line 126 of file misc.h.

Referenced by sim_load_prog(), and sys_syscall().

#define ROUND_DOWN N,
ALIGN       ((N) & ~((ALIGN)-1))
 

Definition at line 130 of file misc.h.

Referenced by ld_load_prog().

#define ROUND_UP N,
ALIGN       (((N) + ((ALIGN)-1)) & ~((ALIGN)-1))
 

Definition at line 129 of file misc.h.

Referenced by ld_load_prog(), and sys_syscall().

#define TRUE   1
 

Definition at line 107 of file misc.h.

Referenced by __check_break(), __opt_process_options(), bind_to_enum(), bpred_lookup(), cache_probe(), cheetah_mstate_obj(), crc(), delete_break(), dlite_cont(), dlite_main(), dlite_options(), dlite_step(), eio_valid(), eventq_execute(), eventq_remove(), exo_print(), fast_SRA(), fast_SRL(), get_next_token(), ident_evaluator(), intern_escape(), ld_load_prog(), lsq_dump(), main(), my_mem_fn(), process_option(), ptrace_open(), readyq_dump(), readyq_enqueue(), ruu_dispatch(), ruu_dump(), ruu_issue(), ruu_link_idep(), ruu_writeback(), set_break(), signal_exit_now(), signal_sim_stats(), sim_check_options(), sim_load_prog(), sim_main(), sim_reg_options(), sym_loadsyms(), and sys_syscall().


Function Documentation

word_t crc word_t    crc_accum,
word_t    data
 

Definition at line 1212 of file misc.c.

References crc_gentab(), crc_init, crc_table, TRUE, and word_t.

Referenced by md_crc_regs().

01213 {
01214   int i, j;
01215 
01216   if (!crc_init)
01217     {
01218       crc_gentab();
01219       crc_init = TRUE;
01220     }
01221 
01222   for (j=0; j < sizeof(word_t); j++)
01223     {
01224       i = ((int)(crc_accum >> 24) ^ (data >> (j*8))) & 0xff;
01225       crc_accum = (crc_accum << 8) ^ crc_table[i];
01226     }
01227   return crc_accum;
01228 }

void debug char *    fmt,
...   
[static]
 

Definition at line 217 of file misc.h.

Referenced by cache_create(), and ld_load_prog().

00217 {}

char* elapsed_time long    sec
 

Definition at line 355 of file misc.c.

00356 {
00357   static char tstr[256];
00358   char temp[256];
00359 
00360   if (sec <= 0)
00361     return "0s";
00362 
00363   tstr[0] = '\0';
00364 
00365   /* days */
00366   if (sec >= 86400)
00367     {
00368       sprintf(temp, "%ldD ", sec/86400);
00369       strcat(tstr, temp);
00370       sec = sec % 86400;
00371     }
00372   /* hours */
00373   if (sec >= 3600)
00374     {
00375       sprintf(temp, "%ldh ", sec/3600);
00376       strcat(tstr, temp);
00377       sec = sec % 3600;
00378     }
00379   /* mins */
00380   if (sec >= 60)
00381     {
00382       sprintf(temp, "%ldm ", sec/60);
00383       strcat(tstr, temp);
00384       sec = sec % 60;
00385     }
00386   /* secs */
00387   if (sec >= 1)
00388     {
00389       sprintf(temp, "%lds ", sec);
00390       strcat(tstr, temp);
00391     }
00392   tstr[strlen(tstr)-1] = '\0';
00393   return tstr;
00394 }

unsigned int extractl int    word,
int    pos,
int    num
 

Definition at line 402 of file misc.c.

00405 {
00406     return(((unsigned int) word >> (pos + 1 - num)) & ~(~0 << num));
00407 }

void fatal char *    fmt,
...   
 

Definition at line 131 of file misc.c.

References file, line, and myvfprintf().

Referenced by __opt_process_options(), bpred_create(), bpred_dir_create(), cache_access(), cache_char2policy(), cache_create(), delete_node(), dump_config(), eio_create(), eio_fast_forward(), eio_open(), eio_read_chkpt(), eio_read_trace(), eval_new(), exo_alloc(), exo_intern(), exo_intern_as(), exo_new(), ft_hash(), hash_lookup_add(), idim2(), init_dmvl(), init_faclru(), init_facopt(), init_saclru(), init_sacopt(), intern_char(), intern_escape(), ld_load_prog(), lsq_init(), lsq_refresh(), main(), mem_create(), mem_newpage(), my_mem_fn(), opt_new(), opt_reg_double(), opt_reg_double_list(), opt_reg_enum(), opt_reg_enum_list(), opt_reg_flag(), opt_reg_flag_list(), opt_reg_float(), opt_reg_float_list(), opt_reg_int(), opt_reg_int_list(), opt_reg_note(), opt_reg_string(), opt_reg_string_list(), opt_reg_uint(), opt_reg_uint_list(), print_dist(), print_sdist(), process_file(), process_groups(), process_option(), ptc(), ptrace_open(), regs_create(), res_create_pool(), rslink_init(), ruu_dispatch(), ruu_init(), set_break(), sim_check_options(), sim_load_prog(), sim_main(), sim_reg_stats(), spec_mem_access(), stack_proc_fa(), stat_add_samples(), stat_eval_ident(), stat_new(), stat_reg_dist(), stat_reg_double(), stat_reg_float(), stat_reg_formula(), stat_reg_int(), stat_reg_sdist(), stat_reg_uint(), sym_loadsyms(), sys_syscall(), unk_hash_add_fa(), and unk_hash_add_sa().

00133 {
00134   va_list v;
00135   va_start(v, fmt);
00136 
00137   fprintf(stderr, "fatal: ");
00138   myvfprintf(stderr, fmt, v);
00139 #ifdef __GNUC__
00140   if (verbose)
00141     fprintf(stderr, " [%s:%s, line %d]", func, file, line);
00142 #endif /* __GNUC__ */
00143   fprintf(stderr, "\n");
00144   if (hook_fn)
00145     (*hook_fn)(stderr);
00146   exit(1);
00147 }

void fatal_hook void(*    hook_fn)(FILE *stream)
 

Definition at line 120 of file misc.c.

References hook_fn.

Referenced by main().

00121 {
00122   hook_fn = fn;
00123 }

void* getcore int    nbytes
 

Definition at line 314 of file misc.c.

Referenced by mem_newpage().

00315 {
00316   return calloc(nbytes, 1);
00317 
00318 #if 0 /* FIXME: sbrk() calls break malloc() on Linux... */
00319 #if !defined(PURIFY) && !defined(_MSC_VER)
00320   void *p = (void *)sbrk(nbytes);
00321 
00322   if (p == (void *)-1)
00323     return NULL;
00324 
00325   /* this may be superfluous */
00326 #if defined(__svr4__) || defined(_MSC_VER)
00327   memset(p, '\0', nbytes);
00328 #else /* !defined(__svr4__) */
00329   bzero(p, nbytes);
00330 #endif
00331   return p;
00332 #else
00333   return calloc(nbytes, 1);
00334 #endif /* PURIFY */
00335 #endif
00336 }

void gzclose FILE *    fd
 

Definition at line 1174 of file misc.c.

Referenced by eio_close(), and eio_valid().

01175 {
01176   fclose(fd);
01177 }

FILE* gzopen char *    fname,
char *    type
 

Definition at line 1168 of file misc.c.

Referenced by eio_create(), eio_open(), and eio_valid().

01169 {
01170   return fopen(fname, type);
01171 }

void info char *    fmt,
...   
 

Definition at line 199 of file misc.c.

References file, line, and myvfprintf().

00201 {
00202   va_list v;
00203   va_start(v, fmt);
00204 
00205   myvfprintf(stderr, fmt, v);
00206 #ifdef __GNUC__
00207   if (verbose)
00208     fprintf(stderr, " [%s:%s, line %d]", func, file, line);
00209 #endif /* __GNUC__ */
00210   fprintf(stderr, "\n");
00211 }

int log_base2 int    n
 

Definition at line 340 of file misc.c.

References panic().

Referenced by cache_create().

00341 {
00342   int power = 0;
00343 
00344   if (n <= 0 || (n & (n-1)) != 0)
00345     panic("log2() only works for positive power of two values");
00346 
00347   while (n >>= 1)
00348     power++;
00349 
00350   return power;
00351 }

void myfprintf FILE *    stream,
char *    format,
...   
 

Definition at line 807 of file misc.c.

References myvsprintf().

Referenced by __check_break(), __ptrace_newinst(), __ptrace_newuop(), dlite_cont(), dlite_dis(), dlite_dump(), dlite_iregs(), dlite_regs(), dlite_status(), eio_read_trace(), eio_write_chkpt(), eval_print(), exo_print(), ld_load_prog(), md_print_creg(), md_print_fpreg(), md_print_insn(), md_print_ireg(), mem_dump(), mspec_dump(), print_sdist(), print_val(), range_print_pos(), ruu_commit(), ruu_dispatch(), ruu_dumpent(), sim_main(), stat_print_stat(), sym_dumpsym(), sys_syscall(), unk_hash_add_fa(), and unk_hash_add_sa().

00808 {
00809   /* temp buffer */
00810   char buf[2048];
00811 
00812   /* vararg parameters */
00813   va_list v;
00814   va_start(v, format);
00815 
00816   myvsprintf(buf, format, v);
00817   fputs(buf, stream);
00818 }

int myrand void   
 

Definition at line 252 of file misc.c.

Referenced by cache_access().

00253 {
00254 #if !defined(__alpha) && !defined(linux)
00255   extern long random(void);
00256 #endif
00257 
00258 #if defined(__CYGWIN32__) || defined(hpux) || defined(__hpux) || defined(__svr4__) || defined(_MSC_VER)
00259   return rand();
00260 #else
00261   return random();
00262 #endif
00263 }

char* mysprintf char *    obuf,
char *    format,
...   
 

Definition at line 785 of file misc.c.

References myvsprintf().

Referenced by stat_print_stat().

00786 {
00787   /* vararg parameters */
00788   va_list v;
00789   va_start(v, format);
00790 
00791   return myvsprintf(obuf, format, v);
00792 }

void mysrand unsigned int    seed
 

Definition at line 241 of file misc.c.

Referenced by main().

00242 {
00243 #if defined(__CYGWIN32__) || defined(hpux) || defined(__hpux) || defined(__svr4__) || defined(_MSC_VER)
00244       srand(seed);
00245 #else
00246       srandom(seed);
00247 #endif
00248 }

char* mystrdup char *    s
 

Definition at line 268 of file misc.c.

References s.

Referenced by cache_create(), exo_deepcopy(), exo_intern(), exo_new(), ld_load_prog(), mem_create(), process_file(), sim_check_options(), sim_reg_stats(), stat_reg_dist(), stat_reg_double(), stat_reg_float(), stat_reg_formula(), stat_reg_int(), stat_reg_sdist(), stat_reg_uint(), and sym_loadsyms().

00269 {
00270   char *buf;
00271 
00272   if (!(buf = (char *)malloc(strlen(s)+1)))
00273     return NULL;
00274   strcpy(buf, s);
00275   return buf;
00276 }

int mystricmp char *    s1,
char *    s2
 

Definition at line 295 of file misc.c.

Referenced by ident_evaluator(), and sim_check_options().

00296 {
00297   unsigned char u1, u2;
00298 
00299   for (;;)
00300     {
00301       u1 = (unsigned char)*s1++; u1 = tolower(u1);
00302       u2 = (unsigned char)*s2++; u2 = tolower(u2);
00303 
00304       if (u1 != u2)
00305         return u1 - u2;
00306       if (u1 == '\0')
00307         return 0;
00308     }
00309 }

char* mystrrchr char *    s,
char    c
 

Definition at line 280 of file misc.c.

References s.

00281 {
00282   char *rtnval = 0;
00283 
00284   do {
00285     if (*s == c)
00286       rtnval = s;
00287   } while (*s++);
00288 
00289   return rtnval;
00290 }

void myvfprintf FILE *    stream,
char *    format,
va_list    v
 

Definition at line 796 of file misc.c.

References myvsprintf().

Referenced by fatal(), info(), panic(), and warn().

00797 {
00798   /* temp buffer */
00799   char buf[2048];
00800 
00801   myvsprintf(buf, format, v);
00802   fputs(buf, stream);
00803 }

char* myvsprintf char *    obuf,
char *    format,
va_list    v
 

Definition at line 456 of file misc.c.

References _lowdigit(), dfloat_t, HIBITL, largeint_t, PAD, PUT, slargeint_t, sword_t, and word_t.

Referenced by myfprintf(), mysprintf(), and myvfprintf().

00457 {
00458   static char _blanks[] = "                    ";
00459   static char _zeroes[] = "00000000000000000000";
00460 
00461   /* counts output characters */
00462   int count = 0;
00463 
00464   /* format code */
00465   int fcode;
00466 
00467   /* field width and precision */
00468   int width, prec;
00469 
00470   /* number of padding zeroes required on the left and right */
00471   int lzero;
00472 
00473   /* length of prefix */
00474   int prefixlength;
00475 
00476   /* combined length of leading zeroes, trailing zeroes, and suffix */
00477   int otherlength;
00478 
00479   /* format flags */
00480 #define PADZERO         0x0001  /* padding zeroes requested via '0' */
00481 #define RZERO           0x0002  /* there will be trailing zeros in output */
00482 #define LZERO           0x0004  /* there will be leading zeroes in output */
00483 #define DOTSEEN         0x0008  /* dot appeared in format specification */
00484 #define LENGTH          0x0010  /* l */
00485   int flagword;
00486 
00487   /* maximum number of digits in printable number */
00488 #define MAXDIGS         22
00489 
00490   /* starting and ending points for value to be printed */
00491   char *bp, *p;
00492 
00493   /* work variables */
00494   int k, lradix, mradix;
00495 
00496   /* pointer to sign, "0x", "0X", or empty */
00497   char *prefix;
00498 
00499   /* values are developed in this buffer */
00500   static char buf[MAXDIGS*4], buf1[MAXDIGS*4];
00501 
00502   /* pointer to a translate table for digits of whatever radix */
00503   char *tab;
00504 
00505   /* value being converted, if integer */
00506   slargeint_t val;
00507 
00508   /* value being converted, if floating point */
00509   dfloat_t fval;
00510 
00511   for (;;)
00512     {
00513       int n;
00514 
00515       while ((fcode = *format) != '\0' && fcode != '%')
00516         {
00517           *obuf++ = fcode;
00518           format++;
00519           count++;
00520         }
00521 
00522       if (fcode == '\0')
00523         {
00524           /* end of format; terminate and return */
00525           *obuf = '\0';
00526           return obuf;
00527         }
00528 
00529 
00530       /* % has been found, the following switch is used to parse the format
00531          specification and to perform the operation specified by the format
00532          letter; the program repeatedly goes back to this switch until the
00533          format letter is encountered */
00534 
00535       width = prefixlength = otherlength = flagword = 0;
00536       format++;
00537 
00538     charswitch:
00539       switch (fcode = *format++)
00540         {
00541         case '0': /* means pad with leading zeros */
00542           flagword |= PADZERO;
00543         case '1':
00544         case '2':
00545         case '3':
00546         case '4':
00547         case '5':
00548         case '6':
00549         case '7':
00550         case '8':
00551         case '9':
00552           {
00553             int num = fcode - '0';
00554             while (isdigit(fcode = *format))
00555               {
00556                 num = num * 10 + fcode - '0';
00557                 format++;
00558               }
00559             if (flagword & DOTSEEN)
00560               prec = num;
00561             else
00562               width = num;
00563             goto charswitch;
00564           }
00565 
00566         case '.':
00567           flagword |= DOTSEEN;
00568           goto charswitch;
00569 
00570         case 'l':
00571           flagword |= LENGTH;
00572           goto charswitch;
00573 
00574         case 'n': /* host counter */
00575 #ifdef HOST_HAS_QWORD
00576           flagword |= LENGTH;
00577           /* fallthru */
00578 #else /* !HOST_HAS_QWORD */
00579           flagword |= DOTSEEN;
00580           if (!width)
00581             width = 12;
00582           prec = 0;
00583           goto process_float;
00584 #endif /* HOST_HAS_QWORD */
00585           
00586         case 'd':
00587           /* fetch the argument to be printed */
00588           if (flagword & LENGTH)
00589             val = va_arg(v, slargeint_t);
00590           else
00591             val = (slargeint_t)va_arg(v, sword_t);
00592 
00593           /* set buffer pointer to last digit */
00594           p = bp = buf + MAXDIGS;
00595 
00596           /* If signed conversion, make sign */
00597           if (val < 0)
00598             {
00599               prefix = "-";
00600               prefixlength = 1;
00601               /* negate, checking in advance for possible overflow */
00602               if (val != (slargeint_t)HIBITL)
00603                 val = -val;
00604               else
00605                 {
00606                   /* number is -HIBITL; convert last digit and get pos num */
00607                   *--bp = _lowdigit(&val);
00608                 }
00609             }
00610 
00611         decimal:
00612           {
00613             slargeint_t qval = val;
00614 
00615             if (qval <= 9)
00616               *--bp = (int)qval + '0';
00617             else
00618               {
00619                 do {
00620                   n = (int)qval;
00621                   qval /= 10;
00622                   *--bp = n - (int)qval * 10 + '0';
00623                 }
00624                 while (qval > 9);
00625                 *--bp = (int)qval + '0';
00626               }
00627           }
00628           break;
00629 
00630         case 'u':
00631           /* fetch the argument to be printed */
00632           if (flagword & LENGTH)
00633             val = va_arg(v, largeint_t);
00634           else
00635             val = (largeint_t)va_arg(v, word_t);
00636 
00637           /* set buffer pointer to last digit */
00638           p = bp = buf + MAXDIGS;
00639 
00640           if (val & HIBITL)
00641             *--bp = _lowdigit(&val);
00642           goto decimal;
00643 
00644         case 'o':
00645           mradix = 7;
00646           lradix = 2;
00647           goto fixed;
00648 
00649         case 'p': /* target address */
00650           if (sizeof(md_addr_t) > 4)
00651             flagword |= LENGTH;
00652           /* fallthru */
00653 
00654         case 'X':
00655         case 'x':
00656           mradix = 15;
00657           lradix = 3;
00658 
00659         fixed:
00660           /* fetch the argument to be printed */
00661           if (flagword & LENGTH)
00662             val = va_arg(v, largeint_t);
00663           else
00664             val = (largeint_t)va_arg(v, word_t);
00665 
00666           /* set translate table for digits */
00667           tab = (fcode == 'X') ? "0123456789ABCDEF" : "0123456789abcdef";
00668 
00669           /* develop the digits of the value */
00670           p = bp = buf + MAXDIGS;
00671 
00672           {
00673             slargeint_t qval = val;
00674 
00675             if (qval == 0)
00676               {
00677                 otherlength = lzero = 1;
00678                 flagword |= LZERO;
00679               }
00680             else
00681               do {
00682                 *--bp = tab[qval & mradix];
00683                 qval = ((qval >> 1) & ~HIBITL) >> lradix;
00684               } while (qval != 0);
00685           }
00686           break;
00687 
00688 #ifndef HOST_HAS_QWORD
00689         process_float:
00690 #endif /* !HOST_HAS_QWORD */
00691 
00692         case 'f':
00693           if (flagword & DOTSEEN)
00694             sprintf(buf1, "%%%d.%df", width, prec);
00695           else if (width)
00696             sprintf(buf1, "%%%df", width);
00697           else
00698             sprintf(buf1, "%%f");
00699 
00700           /* fetch the argument to be printed */
00701           fval = va_arg(v, dfloat_t);
00702 
00703           /* print floating point value */
00704           sprintf(buf, buf1, fval);
00705           bp = buf;
00706           p = bp + strlen(bp);
00707           break;
00708 
00709         case 's':
00710           bp = va_arg(v, char *);
00711           if (bp == NULL)
00712             bp = "(null)";
00713           p = bp + strlen(bp);
00714           break;
00715 
00716         case '%':
00717           buf[0] = fcode;
00718           goto c_merge;
00719 
00720         case 'c':
00721           buf[0] = va_arg(v, int);
00722         c_merge:
00723           p = (bp = &buf[0]) + 1;
00724           break;
00725 
00726         default:
00727           /* this is technically an error; what we do is to back up the format
00728              pointer to the offending char and continue with the format scan */
00729           format--;
00730           continue;
00731         }
00732 
00733       /* calculate number of padding blanks */
00734       k = (n = p - bp) + prefixlength + otherlength;
00735       if (width <= k)
00736         count += k;
00737       else
00738         {
00739           count += width;
00740 
00741           /* set up for padding zeroes if requested; otherwise emit padding
00742              blanks unless output is to be left-justified */
00743           if (flagword & PADZERO)
00744             {
00745               if (!(flagword & LZERO))
00746                 {
00747                   flagword |= LZERO;
00748                   lzero = width - k;
00749                 }
00750               else
00751                 lzero += width - k;
00752 
00753               /* cancel padding blanks */
00754               k = width;
00755             }
00756           else
00757             {
00758               /* blanks on left if required */
00759               PAD(_blanks, width - k);
00760             }
00761         }
00762 
00763       /* prefix, if any */
00764       if (prefixlength != 0)
00765         {
00766           PUT(prefix, prefixlength);
00767         }
00768 
00769       /* zeroes on the left */
00770       if (flagword & LZERO)
00771         {
00772           PAD(_zeroes, lzero);
00773         }
00774 
00775       /* the value itself */
00776       if (n > 0)
00777         {
00778           PUT(bp, n);
00779         }
00780     }
00781 }

void panic char *    fmt,
...   
 

Definition at line 155 of file misc.c.

References file, line, and myvfprintf().

Referenced by __check_break(), add_option(), bind_to_seg(), bp_class_str(), bpred_config(), bpred_create(), bpred_dir_config(), bpred_dir_create(), bpred_dir_lookup(), bpred_lookup(), bpred_reg_stats(), cache_access(), dlite_cont(), dlite_dump(), dlite_exec(), eio_read_trace(), eval_as_addr(), eval_as_double(), eval_as_float(), eval_as_int(), eval_as_uint(), eval_print(), eventq_dump(), eventq_queue_event(), exo_copy(), exo_deepcopy(), exo_delete(), exo_new(), exo_print(), exo_read(), f_add(), f_div(), f_eq_zero(), f_mult(), f_neg(), f_sub(), ident_evaluator(), il1_access_fn(), il2_access_fn(), intern_char(), intern_string(), log_base2(), md_init_decoder(), md_print_creg(), md_print_insn(), md_reg_obj(), my_mem_fn(), opt_print_option(), print_help(), print_val(), process_option(), ptrace_open(), range_cmp_range(), range_cmp_range1(), range_print_pos(), readyq_enqueue(), result_type(), ruu_commit(), ruu_dispatch(), ruu_issue(), ruu_recover(), ruu_writeback(), sim_main(), simoo_reg_obj(), spec_mem_access(), stat_add_samples(), stat_delete(), stat_eval_ident(), stat_print_stat(), sym_bind_addr(), sym_bind_name(), sym_loadsyms(), sys_syscall(), tracer_recover(), and update_way_list().

00157 {
00158   va_list v;
00159   va_start(v, fmt);
00160 
00161   fprintf(stderr, "panic: ");
00162   myvfprintf(stderr, fmt, v);
00163 #ifdef __GNUC__
00164   fprintf(stderr, " [%s:%s, line %d]", func, file, line);
00165 #endif /* __GNUC__ */
00166   fprintf(stderr, "\n");
00167   if (hook_fn)
00168     (*hook_fn)(stderr);
00169   abort();
00170 }

void warn char *    fmt,
...   
 

Definition at line 178 of file misc.c.

References file, line, and myvfprintf().

Referenced by eio_open(), intern_escape(), intern_string(), ld_load_prog(), sim_check_options(), sys_syscall(), and xlate_arg().

00180 {
00181   va_list v;
00182   va_start(v, fmt);
00183 
00184   fprintf(stderr, "warning: ");
00185   myvfprintf(stderr, fmt, v);
00186 #ifdef __GNUC__
00187   if (verbose)
00188     fprintf(stderr, " [%s:%s, line %d]", func, file, line);
00189 #endif /* __GNUC__ */
00190   fprintf(stderr, "\n");
00191 }


Variable Documentation

int verbose
 

Definition at line 133 of file misc.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