vmtrace.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
void _STUB_vmtrace(){}
#else
#include "vmhdr.h"
/* Turn on tracing for regions
**
** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
*/
static int Trfile = -1;
static char Trbuf[128];
#if __STD_C
#else
char* to;
const char* from;
int endc;
#endif
{ reg int n;
to += n;
to += 1;
return to;
}
/* convert a long value to an ascii representation */
#if __STD_C
#else
Vmulong_t v; /* value to convert */
int type; /* =0 base-16, >0: unsigned base-10, <0: signed base-10 */
#endif
{
char* s;
*s-- = '\0';
if(type == 0) /* base-16 */
do
{ *s-- = digit[v&0xf];
v >>= 4;
} while(v);
}
else if(type > 0) /* unsigned base-10 */
{ do
{ *s-- = (char)('0' + (v%10));
v /= 10;
} while(v);
}
else /* signed base-10 */
{ int sign = ((long)v < 0);
if(sign)
v = (Vmulong_t)(-((long)v));
do
{ *s-- = (char)('0' + (v%10));
v /= 10;
} while(v);
if(sign)
*s-- = '-';
}
return s+1;
}
/* generate a trace of some call */
#if __STD_C
#else
#endif
{
const char* file = 0;
int line = 0;
const char* func = 0;
int comma;
int n;
int m;
int type;
#define SLOP 64
{ type = 0;
}
else
}
if(Trfile < 0)
return;
else if(type&VM_MTPROFILE)
else if(type&VM_MTDEBUG)
comma = 0;
{ char* f;
if(f[-1] == '/' || f[-1] == '\\')
break;
file = f;
}
if(m > n)
{ file += (m - n);
}
comma = 1;
}
if(func)
{ if(comma)
*bufp++ = ',';
#if 1
#else
#endif
comma = 1;
}
if(comma)
*bufp++ = ':';
*bufp++ = '\n';
*bufp = '\0';
}
#if __STD_C
#else
const char* s1;
long n1;
const char* s2;
long n2;
#endif
{
if (s1)
{
if (n1)
}
if (s2)
{
if (n2)
}
*bufp++ = '\n';
}
#if __STD_C
#else
int file;
#endif
{
int fd;
return fd;
}
#if __STD_C
#else
#endif
{
return -1;
size_t s;
continue;
}
}
}
return 0;
}
#endif