void HangStruct::IndentHanging(OutputStruct *pOut) { #ifdef DEBUG2 traceOutput(__FILE__, __LINE__, pOut); TRACE(("state:%d/%d, parn:%d/%d, curl:%d, agg:%d/%d\n", indent, stmt_level, until_parn, parn_level, curl_level, do_aggreg, in_aggreg)); #endif if (indent != 0 && curl_level != 0 && (until_parn == 0 || parn_level != 0) && until_curl == 0 && in_aggreg < curl_level && !emptyString(pOut -> pCode) && !emptyString(pOut -> pCFlag) && (pOut -> pCFlag[0] == Normal || !ContinuedQuote(pOut))) { pOut -> indentHangs = indent; if (stmt_level && !until_parn) pOut -> indentHangs += stmt_level; TRACE(("HANG:%d\n", pOut -> indentHangs)); } if (pOut -> pType != PreP) { ScanState(pOut -> pCode, pOut -> pCFlag); ScanState(pOut -> pBrace, pOut -> pBFlag); } }
void traceDecode( uint8_t** ptr ) { char text[128] = {0}; uint32_t value = 0; traceDecodeUInt32( &value, ptr ); uint8_t type = value & TYPE_MASK; value >>= BITS_PER_TYPE; // deserialise the text. switch( type ) { case Marker: // Marker snprintf( &text[0], sizeof(text), "marker %d", value); break; case TruncatedBLOB: case CachedBLOB: case HexDump: { // Hex/binary data. uint32_t numberOfBytes = 0; static uint8_t data[128] = {0}; if ( type == CachedBLOB ) { // cache hit!. hash_t hash = (hash_t)value; // retrieve data from cache. getValueForHash( hash, &data[0], &numberOfBytes ); } else { // cache miss!. numberOfBytes = value; memmove( &data[0], *ptr, numberOfBytes ); addHashAndValueToHistory( *ptr, numberOfBytes ); *ptr += numberOfBytes; } // snprintf( &text[0], sizeof(text), "%d bytes: ", numberOfBytes); char value[8]; for( uint32_t i=0; i<numberOfBytes; i++) { snprintf( &value[0], sizeof(value), "%02x ",data[i] ); strcat( &text[0], &value[0] ); } // Append the ellipses to indicate the BLOB has been truncated. if(type == TruncatedBLOB) { strcat( &text[0], "..." ); } break; } case PrintF: { // Serialised printf. const char* pAddress = decodeConstantStringPointer( value ); traceDecodePrintf( ptr, &text[0], sizeof(text), pAddress ); break; } default: printf("\n[Unprocessed trace type %x]\n",type); exit(-1); break; } // output the text. traceOutput( text ); }