コード例 #1
0
ファイル: timexLib.c プロジェクト: andy345/vxworks5
LOCAL void timexShowCalls
    (
    CALL_ARRAY calls            /* list of functions to be displayed */
    )
    {
    char      *name;            /* pointer to sym table's copy of name string */
    char      demangled [TIMEX_DEMANGLE_PRINT_LEN + 1];
    char      *nameToPrint;
    void      *value;
    SYMBOL_ID symId;            /* symbol identifier */
    int       offset;
    int       i;
    int       j;
    int       arg;
    int       ncalls = 0;

    for (i = 0; i < MAX_CALLS; i++)
	{
	if (calls[i].func != timexNull)
	    {
	    ncalls++;

	    if ((symFindSymbol (sysSymTbl, NULL, (void *)calls[i].func, 
				SYM_MASK_NONE, SYM_MASK_NONE, 
				&symId) != OK) ||
		(symNameGet (symId, &name) != OK) ||
		(symValueGet (symId, &value) != OK))
		printf ("        %d: 0x%x (", i, (int)calls[i].func);
	    else
		{
	        offset = (int) calls[i].func - (int) value;
	        nameToPrint = cplusDemangle (name, demangled, 
					     sizeof (demangled));
	        if (offset == 0)
		    printf ("        %d: %s (", i, nameToPrint);
	        else
		    printf ("        %d: %s+%x (", i, nameToPrint, offset);
		}

	    for (j = 0; j < MAX_ARGS; j++)
		{
		if (j != 0)
		    printf (", ");

		arg = calls[i].arg[j];
		if ((-9 <= arg) && (arg <= 9))
		    printf ("%d", arg);
		else
		    printf ("0x%x", arg);
		}
	    printf (")\n");
	    }
	}

    if (ncalls == 0)
	printf ("        (none)\n");
    }
コード例 #2
0
ファイル: classShow.c プロジェクト: phoboz/vmx
LOCAL void classShowSymbol(
    ARG value
    )
{
    SYMBOL_ID symId;
    char *name = NULL;
    ARG symValue = (ARG) 0;

    /* If no value */
    if (value == (ARG) 0)
    {
        fprintf(stderr, "No routine attached.\n");
    }
    else
    {
        /* If symbol found */
        if (symFindSymbol(
                sysSymTable,
                NULL,
                value,
                SYM_MASK_NONE,
                SYM_MASK_NONE,
                &symId
                ) == OK)
        {
            /* Get name and value */
            symNameGet(symId, &name);
            symValueGet(symId, &symValue);
        }

        if (symValue == value)
        {
            printf(" (%s)", name);
        }

        printf("\n");
    }
}