Beispiel #1
0
void DumpAllSyms(FILE *out)
{
    SYMBOL *Sym;

    int n;

    fprintf(out, "ALL_SYMS\n");

    Sym = SymTab;
    n = SYMMAX;

    do
    {
        {
            fprintf(out, "Ltype %i,sec %i,type %i", Sym->LabelType, Sym->Section, Sym->Type);
            fprintf(out, " %s ",Sym->Name);
            fprintf(out, "%s,",Hex32(Sym->Value));
            fprintf(out, "%s",Hex32(Sym->EndIP));
            fprintf(out, "\n");
        }

        Sym++;
    }
    while(--n);

    return;
}
Beispiel #2
0
void DumpEnumEntry(SYMBOL *Sym)
{
    SYMBOL	*theSym;

    if (!Sym)
    {
        printf("Null Symbol\n");
        return;
    }

#if 0
    if (Sym < SymTab)
        return;

    if ((int) Sym >= (int)((int) SymTab + sizeof(SYMBOL) * SYMMAX) )
        return;
#endif

    if ((Sym->Section == section_Enum) && (Sym->LocalScope != 0))
    {
        if ((Sym->Flags & SymFlag_Ref) == 0)
            printf("*Unref* ");

        theSym = FindSymbols(Sym->Name,section_Enum,section_Enum, 0);

        if (theSym)
            printf("Global %2d: ",Sym->LocalScope);
        else
            printf("Local  %2d: ",Sym->LocalScope);

        printf("%2s ", Sect_Strings[Sym->Type]);

        printf("0x%s ",Hex32(Sym->Value));
        printf("- 0x%s ",Hex32(Sym->EndIP));

        printf("'%s'",Sym->Name);

        switch(Sym->LabelType)
        {
        case label_Local:
            printf(" (Local)");
            break;

        case label_Function:
            printf(" (Function)(%d)", Sym->Params);
            break;

        case label_Virtual:
            printf(" (Virtual Function 0x%x)(%d)", Sym->VirtualIndex, Sym->Params);
            break;
        }

        printf("\n");

    }
}
Beispiel #3
0
void DumpFunctions(FILE *out)
{
    SYMBOL	*Sym;
    int lastVal = -1;
    int		n;

    fprintf(out, "FUNCTIONS\n");

    Sym = SymTab;
    n = SYMMAX;

    do
    {
        if (((Sym->LabelType == label_Function) || (Sym->LabelType == label_Virtual))
                //&& ((Sym->Section == section_Label) || (Sym->Section == section_Global)))
                //&& Sym->EndIP != 0)
                && (Sym->Section == section_Enum) && (Sym->Type != SECT_null))
        {
            fprintf(out, "%s ",Sym->Name);
            fprintf(out, "%s,",Hex32(Sym->Value));
            fprintf(out, "%s",Hex32(Sym->EndIP));
#if 0	// for debugging
            fprintf(out, "(t%i, lt%i, s%i, vi%i, ls%i, le%i)",
                    Sym->Type, Sym->LabelType, Sym->Section, Sym->VirtualIndex,
                    Sym->LocalScope, Sym->LabelEnum);
#endif
            fprintf(out, "\n");
            if(Sym->Value > Sym->EndIP || Sym->Value <= lastVal) {
                printf("Warning: problematic symbol value: %s\n", Sym->Name);
            }
            lastVal = Sym->Value;
        }

        Sym++;
    }
    while(--n);

    fprintf(out, "CDTOR ");
    fprintf(out, "%s,",   Hex32(CDtorStart));
    fprintf(out, "%s\n",  Hex32(CDtorEnd));
    return;
}
Beispiel #4
0
static void sectionMapping(IO &IO, ELFYAML::MipsABIFlags &Section) {
  commonSectionMapping(IO, Section);
  IO.mapOptional("Version", Section.Version, Hex16(0));
  IO.mapRequired("ISA", Section.ISALevel);
  IO.mapOptional("ISARevision", Section.ISARevision, Hex8(0));
  IO.mapOptional("ISAExtension", Section.ISAExtension,
                 ELFYAML::MIPS_AFL_EXT(Mips::AFL_EXT_NONE));
  IO.mapOptional("ASEs", Section.ASEs, ELFYAML::MIPS_AFL_ASE(0));
  IO.mapOptional("FpABI", Section.FpABI,
                 ELFYAML::MIPS_ABI_FP(Mips::Val_GNU_MIPS_ABI_FP_ANY));
  IO.mapOptional("GPRSize", Section.GPRSize,
                 ELFYAML::MIPS_AFL_REG(Mips::AFL_REG_NONE));
  IO.mapOptional("CPR1Size", Section.CPR1Size,
                 ELFYAML::MIPS_AFL_REG(Mips::AFL_REG_NONE));
  IO.mapOptional("CPR2Size", Section.CPR2Size,
                 ELFYAML::MIPS_AFL_REG(Mips::AFL_REG_NONE));
  IO.mapOptional("Flags1", Section.Flags1, ELFYAML::MIPS_AFL_FLAGS1(0));
  IO.mapOptional("Flags2", Section.Flags2, Hex32(0));
}
Beispiel #5
0
void DumpVariables(FILE *out)
{
    SYMBOL *Sym;

    int n;

    fprintf(out, "VARIABLES\n");

    Sym = SymTab;
    n = SYMMAX;

    do
    {
        //if (Sym->Section == section_Global)
        if(Sym->LabelType == label_Local && Sym->Section == section_Enum &&
                (Sym->Type == SECT_data || Sym->Type == SECT_bss) &&
                strchr(Sym->Name, '.') == 0)	//HACK
        {
            int value = Sym->Value;

            if(Sym->Type == SECT_bss)
            {
                value += MaxDataIP;
            }

            fprintf(out, "%s %i ",Sym->Name, Sym->LocalScope);
            fprintf(out, "%s",Hex32(value));
            fprintf(out, "\n");
        }

        Sym++;
    }
    while(--n);

    return;
}
Beispiel #6
0
void TDebug68k::UpdateVals(void)
{
        void *p1, *p2;
        char buf[256];

        D0->Caption=Hex32(reg[0]);
        D1->Caption=Hex32(reg[1]);
        D2->Caption=Hex32(reg[2]);
        D3->Caption=Hex32(reg[3]);
        D4->Caption=Hex32(reg[4]);
        D5->Caption=Hex32(reg[5]);
        D6->Caption=Hex32(reg[6]);
        D7->Caption=Hex32(reg[7]);

        A0->Caption=Hex32(reg[8]);
        A1->Caption=Hex32(reg[9]);
        A2->Caption=Hex32(reg[10]);
        A3->Caption=Hex32(reg[11]);
        A4->Caption=Hex32(reg[12]);
        A5->Caption=Hex32(reg[13]);
        A6->Caption=Hex32(reg[14]);

        USP->Caption=Hex32(usp);
        SSP->Caption=Hex32(ssp);

        p1=memory+(pc&0xfffff);

        p2=dis(p1, buf); Dis1->Caption=buf; p1=p2;
        p2=dis(p1, buf); Dis2->Caption=buf; p1=p2;
        p2=dis(p1, buf); Dis3->Caption=buf; p1=p2;
        p2=dis(p1, buf); Dis4->Caption=buf; p1=p2;
        p2=dis(p1, buf); Dis5->Caption=buf; p1=p2;
        p2=dis(p1, buf); Dis6->Caption=buf; p1=p2;
        p2=dis(p1, buf); Dis7->Caption=buf; p1=p2;
        p2=dis(p1, buf); Dis8->Caption=buf; p1=p2;




}
Beispiel #7
0
void DumpMetaData ( FILE *out )
{
    SYMBOL	*Sym;
    int lastVal = -1;
    //int lastEnd = -1;
    int		n;
    static char *returnType[RET_double+1];

    returnType[RET_null]  = "0"; //"[]";
    returnType[RET_void]  = "0"; //"[]";
    returnType[RET_int]   = "1"; //"[r14]";
    returnType[RET_float] = "1"; //"[r14]";
    returnType[RET_double]= "2"; //"[r14,r15]";

    fprintf(out, "Meta\n");

    Sym = SymTab;
    n = SYMMAX;

    do
    {
        if (((Sym->LabelType == label_Function) || (Sym->LabelType == label_Virtual))
                && (Sym->Section == section_Enum) && (Sym->Type == SECT_code))
        {
            fprintf(out, "F<%s,",Sym->Name);
            fprintf(out, "%s,",Hex32(Sym->Value));
            fprintf(out, "%s,",Hex32(Sym->EndIP));
            fprintf(out, "%d,", Sym->Params > 4 ? 4 : Sym->Params );
            fprintf(out, "%s", returnType[(int)(Sym->RetType)]);
            fprintf(out, ">\n");

            if(Sym->Value > Sym->EndIP || Sym->Value <= lastVal) {
                printf("Warning: problematic symbol value: %s\n", Sym->Name);
            }

            lastVal = Sym->Value;
            //lastEnd = Sym->EndIP;
        }
        /*
        else if (((Sym->LabelType == label_Local))
        	&& (Sym->Section == section_Enum) && (Sym->Type == SECT_code))
        {
        	if(Sym->Value <= lastEnd) {
        		// Skip debug labels
        		if (! IsDebugLabel( Sym->Name ) )
        		{
        			fprintf(out, "L<%s,",Sym->Name);
        			fprintf(out, "%s",Hex32(Sym->Value));
        			fprintf(out, ">\n");
        		}
        	}
        }
        */
        else if ((Sym->Section == section_SysCall))
        {
            fprintf(out, "S<%s,", Sym->Name);
            fprintf(out, "%s,", Hex32(Sym->Value));
            fprintf(out, "%d,", Sym->Params > 4 ? 4 : Sym->Params );
            fprintf(out, "%s", returnType[(int)(Sym->RetType)]);
            fprintf(out, ">\n");
        }


        Sym++;
    }
    while(--n);

    return;
}