Exemplo n.º 1
0
static bool cgrfDumpNode(       // DUMP CALL GRAPH NODE
    CALLGRAPH *ctl,             // - call graph information
    CALLNODE *node )            // - node to dump
{
    SYMBOL func;
    VBUF vbuf;

    func = node->base.object;
    if( func == NULL ) {
        func = ModuleInitFuncSym();
    }
    printf( "\nNode[%p] depth(%d) refs(%d) addrs(%d) opcodes(%d) cflags(%d)\n"
            "         inline_fun(%d) inlineable(%d) oe(%d) cgfile(%p)\n"
            "         state_table(%d) rescan(%d) stab_gen(%d)\n"
            "         %s flags(%x)\n"
          , node
          , node->depth
          , node->refs
          , node->addrs
          , node->opcodes
          , node->cond_flags
          , node->inline_fun
          , node->inlineable
          , node->inlineable_oe
          , node->cgfile
          , node->state_table
          , node->rescan
          , node->stab_gen
          , DbgSymNameFull( node->base.object, &vbuf )
          , func->flag );
    CgrfWalkCalls( ctl, node, &cgrfDumpCall );
    VbufFree( &vbuf );
    return false;
}
Exemplo n.º 2
0
PTREE DataDtorObjPush(          // START OF DTORABLE OBJECT
    PTREE expr,                 // - expression to be decorated
    TYPE type,                  // - type of object
    SYMBOL init_sym,            // - symbol being initialized
    target_offset_t offset )    // - offset of object being initialized
{
    TYPE dtor_type;             // - type for dtor

#ifndef NDEBUG
    if( PragDbgToggle.dump_data_dtor ) {
        printf( "DataDtorObjPush -- symbol %s\n"
                "                -- offset %x\n"
                "                -- "
              , DbgSymNameFull( init_sym )
              , offset );
        DumpFullType( type );
    }
#endif
    dtor_type = type;
    if( NULL != ArrayType( dtor_type ) ) {
        dtor_type = ArrayBaseType( dtor_type );
    }
    CDoptDtorBuild( dtor_type );
    FunctionHasRegistration();
    return PtdObjPush( expr, type, init_sym, offset );
}
Exemplo n.º 3
0
static bool cgrfDumpCall(       // DUMP CALL GRAPH EDGE
    CALLGRAPH *ctl,             // - call graph information
    CALLEDGE *edge )            // - edge in graph
{
    VBUF vbuf;
    ctl = ctl;
    printf( "- calls[%p] refs(%d) addrs(%d) %s\n"
          , edge
          , edge->refs
          , edge->addrs
          , DbgSymNameFull( edge->base.target->object, &vbuf ) );
    VbufFree( &vbuf );
    return false;
}
Exemplo n.º 4
0
void DbgGenned(                 // INDICATE SYMBOL GENERATED
    SYMBOL sym )                // - the symbol
{
    if( NULL == sym ) {
        printf( "Generated: module initialization\n" );
    } else {
        VBUF vbuf;
        printf( "Generated: %s\n"
              , DbgSymNameFull( sym, &vbuf ) );
        if( sym->flag2 & SF2_TOKEN_LOCN ) {
            dumpLocation( &sym->locn->tl );
        }
        VbufFree( &vbuf );
    }
}
Exemplo n.º 5
0
void *CtxWhereAreYou(           // SET DEBUGGING BUFFER
    void )
{
    char *buf;                  // - points into buffer

    buf = stpcpy( CompilerContext, ctx_names[ context ] );
    switch( context ) {
      case CTX_CMDLN_ENV :
      case CTX_CMDLN_PGM :
        buf = stpcpy( buf, ": " );
        buf = stpcpy( buf, CtxGetSwitchAddr() );
        break;
      case CTX_FORCED_INCS :
      case CTX_SOURCE :
        if( location.src_file == NULL ) break;
        buf = stpcpy( buf, ": " );
        buf = stpcpy( buf, SrcFileName( location.src_file ) );
        buf = stpcpy( buf, "(" );
        buf = stdcpy( buf, location.line );
        buf = stpcpy( buf, "," );
        buf = stdcpy( buf, location.column );
        buf = stpcpy( buf, ")" );
        break;
      case CTX_CG_FUNC :
      case CTX_FUNC_GEN :
        buf = stpcpy( buf, ": " );
        if( func == NULL ) {
            buf = stpcpy( buf, "data generation" );
        } else {
            VBUF vbuf;
            buf = stpcpy( buf, DbgSymNameFull( func, &vbuf ) );
            VbufFree( &vbuf );
        }
        if( ( context == CTX_FUNC_GEN )
          &&( line != 0 ) ) {
            buf = stpcpy( buf, "(" );
            buf = stdcpy( buf, location.line );
            buf = stpcpy( buf, ")" );
        }
        break;
    }
    return CompilerContext;
}
Exemplo n.º 6
0
void DumpCgFront(               // DUMP GENERATED CODE
    const char *prefix,         // - name added to print line
    DISK_ADDR disk_blk,         // - disk block
    DISK_OFFSET offset,         // - disk offset
    void *instruction )         // - intermediate code
{
    CGINTER *ins;               // - instruction
    char *opcode;               // - opcode
    unsigned uvalue;            // - value with opcode
    VBUF vbuf;

    ins = instruction;
    opcode = DbgIcOpcode( ins->opcode );
    if( ins->opcode == IC_EOF ) {
        uvalue = 0;
    } else {
        uvalue = ins->value.uvalue;
    }
    switch( optypes[ ins->opcode ] ) {
      case DBG_OPCODE_SYM :
        printf(                 F_NAME
                " "             F_BUF_FMT
                " "             F_INSTR
                " "             F_HEX_4
                " "             F_NAME F_EOL
              , prefix
              , disk_blk, offset
              , opcode
              , uvalue
              , DbgSymNameFull( ins->value.pvalue, &vbuf ) );
        VbufFree( &vbuf );
        break;
      case DBG_OPCODE_TYP :
      { VBUF fmt_prefix, fmt_suffix;
        FormatType( ins->value.pvalue, &fmt_prefix, &fmt_suffix );
        printf(                 F_NAME
                " "             F_BUF_FMT
                " "             F_INSTR
                " "             F_HEX_4
                " %s<id>%s" F_EOL
              , prefix
              , disk_blk, offset
              , opcode
              , uvalue
              , VbufString( &fmt_prefix )
              , VbufString( &fmt_suffix ) );
        VbufFree( &fmt_prefix );
        VbufFree( &fmt_suffix );
      } break;
      case DBG_OPCODE_NUL :
        printf(                 F_NAME
                " "             F_BUF_FMT
                " "             F_INSTR F_EOL
              , prefix
              , disk_blk, offset
              , opcode );
        break;
      case DBG_OPCODE_SRC :
      {
        printf(                 F_EOL F_NAME
                " "             F_BUF_FMT
                " "             F_INSTR
                " "             F_NAME F_EOL
              , prefix
              , disk_blk, offset
              , opcode
              , SrcFileFullName( ins->value.pvalue ) );
      } break;
      case DBG_OPCODE_SCP :
        printf(                 F_NAME
                " "             F_BUF_FMT
                " "             F_INSTR
                " "             "scope: " F_HEX F_EOL
              , prefix
              , disk_blk, offset
              , opcode
              , uvalue );
        break;
      case DBG_OPCODE_STR :
      case DBG_OPCODE_CON :
      case DBG_OPCODE_BIN :
        switch( ins->opcode ) {
          case IC_OPR_BINARY :
          case IC_OPR_UNARY :
            printf(                 F_NAME
                    " "             F_BUF_FMT
                    " "             F_INSTR
                    " "             F_NAME F_EOL
                  , prefix
                  , disk_blk, offset
                  , opcode
                  , DbgOperator( ins->value.uvalue ) );
            break;
          case IC_DBG_LINE :
            printf(                 F_NAME
                    " "             F_BUF_FMT
                    " "             F_INSTR
                    " "             F_DECIMAL F_EOL F_EOL
                  , prefix
                  , disk_blk, offset
                  , opcode
                  , uvalue );
            break;
          default :
            printf(                 F_NAME
                    " "             F_BUF_FMT
                    " "             F_INSTR
                    " "             F_HEX F_EOL
                  , prefix
                  , disk_blk, offset
                  , opcode
                  , uvalue );
            break;
        }
        break;
      default :
        CFatal( "**** UNDEFINED OPCODE TYPE *****" );
        break;
    }
}