You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by wh...@apache.org on 2004/11/01 15:12:07 UTC

cvs commit: ws-axis/c/tools/trace/org/apache/axis/tracetool Exclusions.java

whitlock    2004/11/01 06:12:07

  Modified:    c/src/common AxisTrace.cpp AxisTrace.h
               c/tools/trace/org/apache/axis/tracetool Exclusions.java
  Log:
  Trace improvements
  
  Revision  Changes    Path
  1.35      +49 -17    ws-axis/c/src/common/AxisTrace.cpp
  
  Index: AxisTrace.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/AxisTrace.cpp,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- AxisTrace.cpp	26 Oct 2004 09:37:57 -0000	1.34
  +++ AxisTrace.cpp	1 Nov 2004 14:12:07 -0000	1.35
  @@ -257,9 +257,10 @@
   {
       if (!isTraceOn()) return;
   
  -	try 
  -	{
  -		string line = "{ ";
  +	try {
  +		string line;
  +		for (int is=0; is<m_stack.size(); is++) line += " ";
  +		line += "{ ";
   		if (NULL!=className) {
   			line += className;
   			if (NULL!=that) {
  @@ -278,8 +279,7 @@
   
   		va_list args;
   		va_start(args, nParms);
  -		for (int i=0; i<nParms; i++) 
  -		{
  +		for (int i=0; i<nParms; i++) {
   			AxisTraceType type = va_arg(args, AxisTraceType);
   			unsigned len = va_arg(args, unsigned);
   			void *value = va_arg(args, void*);
  @@ -292,6 +292,11 @@
       } catch (...) {
           traceLine("Unknown exception caught during trace entry");
       }
  +
  +	string name = className;
  +	name += "::";
  +	name += methodName;
  +	m_stack.push(name);
   }
   
   void AxisTrace::traceExit(const char *className, const char *methodName, 
  @@ -299,9 +304,17 @@
   {
       if (!isTraceOn()) return;
   
  -	try 
  -	{
  -		string line = "} ";
  +	try {
  +		// Careful here in case entries and exits don't match
  +		string name = className;
  +		name += "::";
  +		name += methodName;
  +		while (m_stack.size()>0 && name!=m_stack.top()) m_stack.pop();
  +		if (m_stack.size()>0) m_stack.pop();
  +
  +		string line;
  +		for (int is=0; is<m_stack.size(); is++) line += " ";
  +		line += "} ";
   		if (NULL!=className) {
   			line += className;
   			line += "::";
  @@ -323,9 +336,16 @@
   {
       if (!isTraceOn()) return;
   
  -	try 
  -	{
  +	try {
  +		// The method that caught the exception may not be top of the stack.
  +		string name = className;
  +		name += "::";
  +		name += methodName;
  +		while (m_stack.size()>0 && name!=m_stack.top()) m_stack.pop();
  +
   		string line;
  +		for (int is=0; is<m_stack.size(); is++) line += " ";
  +		line += "!";
   		if (NULL!=className) {
   			line += className;
   			line += "::";
  @@ -344,19 +364,24 @@
   void AxisTrace::addParameter(string& line, AxisTraceType type, unsigned len, void *value)
   {
   	char prim[32]; // Plenty big enough to hold a primitive
  +      char *pcValue = (char*)value;
   	switch (type) 
   	{
   	case TRACETYPE_CHAR:	sprintf(prim,"%c" ,*((char  *)value));	line += prim;	break;
   	case TRACETYPE_USHORT:	sprintf(prim,"%hu",*((short *)value));	line += prim;	break;
   	case TRACETYPE_SHORT:	sprintf(prim,"%hd",*((short *)value));	line += prim;	break;
   	case TRACETYPE_UINT:	sprintf(prim,"%u" ,*((int   *)value));	line += prim;	break;
  -	case TRACETYPE_INT:		sprintf(prim,"%d" ,*((int   *)value));	line += prim;	break;
  +	case TRACETYPE_INT:	sprintf(prim,"%d" ,*((int   *)value));	line += prim;	break;
   	case TRACETYPE_ULONG:	sprintf(prim,"%lu",*((long  *)value));	line += prim;	break;
   	case TRACETYPE_LONG:	sprintf(prim,"%ld",*((long  *)value));	line += prim;	break;
   	case TRACETYPE_UDOUBLE:	sprintf(prim,"%Lu",*((double*)value));	line += prim;	break;
   	case TRACETYPE_DOUBLE:	sprintf(prim,"%Ld",*((double*)value));	line += prim;	break;
   	case TRACETYPE_FLOAT:	sprintf(prim,"%f" ,*((float *)value));	line += prim;	break;
   
  +	case TRACETYPE_BOOL:
  +		line += *((bool*)value)?"true":"false";
  +		break;
  +
   	/*
   	 * This code only prints out the first 32 bytes of storage pointed at by a 
   	 * pointer. This is to prevent huge blocks of atorage repeatedly being output
  @@ -365,10 +390,13 @@
   	 * in a more human-friendly format.
   	 */
   	case TRACETYPE_POINTER:	
  -		sprintf(prim,"%p ",value);	
  +            pcValue = *((char**)pcValue);
  +		sprintf(prim,"%p ",pcValue);	
   		line += prim;	
  +		// no break!
  +	
  +	case TRACETYPE_DATA:	
   		try {
  -			char *pcValue = (char*)value;
   			line += "[";
   			for (int i=0; i<len && i<32; i++) {
   				int x = (int)(pcValue[i]);
  @@ -377,7 +405,9 @@
   			}
   			line += "] <";
   			for (int j=0; j<len && j<32; j++) {
  -				sprintf(prim,"%c",pcValue[j]);
  +				char c = pcValue[j];
  +				if (!isprint(c)) c='.';
  +				sprintf(prim,"%c",c);
   				line += prim;
   			}
   			line += ">";
  @@ -388,8 +418,9 @@
   
   	case TRACETYPE_STRING:	
   		try {
  +                  pcValue = *((char**)pcValue);
   			line += "\"";	
  -			line += (char*)value;	
  +			line += pcValue;	
   			line += "\"";	
   		} catch (...) {
   			line += "<BADPOINTER>";
  @@ -397,8 +428,9 @@
   		break;
   
   	default:
  -		line += "<UNKNOWN TYPE";				
  -		line += type;
  +		sprintf(prim,"%d",type);
  +		line += "<UNKNOWNTYPE";				
  +		line += prim;
   		line += ">";
   		break;
   	}
  
  
  
  1.13      +4 -2      ws-axis/c/src/common/AxisTrace.h
  
  Index: AxisTrace.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/AxisTrace.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AxisTrace.h	20 Oct 2004 16:27:04 -0000	1.12
  +++ AxisTrace.h	1 Nov 2004 14:12:07 -0000	1.13
  @@ -26,6 +26,7 @@
   
   #include "AxisFile.h"
   #include <string>
  +#include <stack>
   
   #if defined(ENABLE_AXISTRACE)  
     #define AXISTRACE1(X, Y) g_pAT->logaxis(X,Y,__FILE__,__LINE__);
  @@ -70,7 +71,9 @@
   	TRACETYPE_UDOUBLE,
   	TRACETYPE_DOUBLE,
   	TRACETYPE_FLOAT,
  +	TRACETYPE_BOOL,
   	TRACETYPE_POINTER,
  +	TRACETYPE_DATA,
   	TRACETYPE_STRING
   } AxisTraceType;
   
  @@ -218,13 +221,12 @@
       char m_acLine[4];
       char* m_pcLevel;
       AxisFile m_fileTrace;
  +	std::stack<std::string> m_stack;
   
       int setFilePerm(const char* pcFileName);
       int logthis(const char* pcLog, int level, char* arg2, int arg3);
   	void addParameter(std::string& line, AxisTraceType type, unsigned len, void *value);
   };
  -
  -/* static AxisTrace tracer; */
   
   AXIS_CPP_NAMESPACE_END
   
  
  
  
  1.5       +1 -0      ws-axis/c/tools/trace/org/apache/axis/tracetool/Exclusions.java
  
  Index: Exclusions.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tools/trace/org/apache/axis/tracetool/Exclusions.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Exclusions.java	11 Oct 2004 15:13:59 -0000	1.4
  +++ Exclusions.java	1 Nov 2004 14:12:07 -0000	1.5
  @@ -53,6 +53,7 @@
   			"SoapSerializer.h",
   			"SoapDeSerializer.h",
   			"HeaderBlock.h",
  +			"SoapSerializer.cpp", // fails on "..."
   
   		// Axis.cpp contains a copyright sign (circle with a "C" in it) which 
   		// makes readline throw a MalformedInputException on linux possibly due to