コード例 #1
0
void FreeImage( image_entry *image )
{
    image_entry         **owner;
    image_entry         *curr;
    map_entry           *head;
    map_entry           *next;

    for( owner = &DbgImageList; (curr = *owner) != NULL; owner = &curr->link ) {
        if( curr == image ) {
            if( curr == ImageEntry( ContextMod ) ) {
                ContextMod = NO_MOD;
            }
            if( curr == ImageEntry( CodeAddrMod ) ) {
                CodeAddrMod = NO_MOD;
            }
            VarUnMapScopes( curr );
            UnMapPoints( curr );
            *owner = curr->link;
            for( head = curr->map_list; head != NULL; head = next ) {
                next = head->link;
                _Free( head );
            }
            _Free( curr->symfile_name );
            _Free( curr );
            break;
        }
    }
}
コード例 #2
0
static void Conclude( invokes *inv )
{
    if( inv->inv_input != NIL_HANDLE ) {
        FileClose( inv->inv_input );
    }
    FreeRing( inv->prmlst );
    _Free( inv->buff );
    _Free( inv );
}
コード例 #3
0
ファイル: dbgwimg.c プロジェクト: MikeyG/open-watcom-v2
static void     ImgMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    image_entry *img;
    char        *new_name;
    char        *old_name;

    piece=piece;
    img = ImgGetImage( row );
    switch( id ) {
    case MENU_INITIALIZE:
        WndMenuGrayAll( wnd );
        if( img != NULL ) {
            if( img->dip_handle == NO_MOD ) {
                WndMenuEnable( wnd, MENU_IMAGE_ADD_SYMBOLS, TRUE );
            } else {
                WndMenuEnableAll( wnd );
            }
        }
        break;
    case MENU_IMAGE_ADD_SYMBOLS:
        // nyi - change sym_file
        if( img->deferred_symbols ) {
            ReLoadSymInfo( img );
        } else {
            new_name = DupStr( ImgSymName( img, TRUE ) );
            if( !SymBrowse( &new_name ) ) {
                _Free( new_name );
            } else {
                UnLoadSymInfo( img, TRUE );
                old_name = img->sym_name;
                img->sym_name = new_name;
                if( ReLoadSymInfo( img ) ) {
                    _Free( old_name );
                } else {
                    img->sym_name = old_name;
                    _Free( new_name );
                }
            }
        }
        ImgInit( wnd );
        break;
    case MENU_IMAGE_DEL_SYMBOLS:
        UnLoadSymInfo( img, TRUE );
        ImgInit( wnd );
        break;
    case MENU_IMAGE_SHOW_FUNCTIONS:
        WndGblFuncInspect( img->dip_handle );
        break;
    case MENU_IMAGE_SHOW_MODULES:
        WndModListInspect( img->dip_handle );
        break;
    case MENU_IMAGE_SHOW_GLOBALS:
        WndGblVarInspect( img->dip_handle );
        break;
    }
}
コード例 #4
0
static void DoInvoke( handle hndl, char *name, char_ring *parmlist )
{
    invokes     *inv;

    _Alloc( inv, sizeof( invokes ) + strlen( name ) );
    if( inv != NULL ) {
        inv->buff_size = CMD_LEN;
        _Alloc( inv->buff, inv->buff_size+1 ); /* extra for NULLCHAR */
    }
    if( inv == NULL || inv->buff == NULL ) {
        if( inv != NULL ) _Free( inv );
        FileClose( hndl );
        FreeRing( parmlist );
        Error( ERR_NONE, LIT( ERR_NO_MEMORY ) );
    }
    strcpy( inv->name, name );
    inv->in_size = 0;
    inv->in_off = 0;
    inv->flags = 0;
    inv->redirect = NULL;
    inv->inv_input = hndl;
    inv->prmlst = parmlist;
    inv->number = InvCount++;
    inv->line = 0;
    PushInpStack( inv, DoneInvLine, TRUE );
    TypeInpStack( INP_CMD_FILE );
}
コード例 #5
0
void DebugFini( void )
{
    PointFini();
#if !( defined( __GUI__ ) && defined( __OS2__ ) )
    ReleaseProgOvlay( TRUE ); // see dlgfile.c
#endif
    VarDisplayFini();
    FiniHook();
    FiniCmd();
    LogFini();
    while( !PurgeInpStack() ) {
        ClearInpStack( INP_STOP_PURGE );
    }
    LangSetFini();
    SupportFini();
    FiniTrap();
    RecordFini();
    FiniMachState();
    FiniDbgInfo();
    FiniScan();
    FiniLook();
    FiniDLLList();
    FiniSource();
    FiniCall();
    PathFini();
    DUIFini();
    SymCompFini();
    FiniMADInfo();
    FiniTrace();
    RestoreHandlers();
    _Free( TrapParms );
    FiniLiterals();
    FiniLocalInfo();
}
コード例 #6
0
ファイル: qnxscrn.c プロジェクト: Azarien/open-watcom-v2
void InitScreen( void )
{
    if( setpgid( 0, 0 ) != 0 && errno != EPERM ) {
        StartupErr( "unable to create new process group" );
    }
    if( TryTTY() ) {
        ConMode = C_TTY;
    } else if( TryQConsole() ) {
        ConMode = C_QCON;
    } else if( TryXWindows() ) {
        ConMode = C_XWIN;
    } else {
        StartupErr( "unable to initialize debugger screen" );
    }
    _Free( DbgTerminal );
    DbgTerminal = NULL;
    fcntl( DbgConHandle, F_SETFD, (int)FD_CLOEXEC );
    UIConHandle = DbgConHandle;
    if( !uistart() ) {
        StartupErr( "unable to initialize user interface" );
    }
    if( _IsOn( SW_USE_MOUSE ) )
        GUIInitMouse( 1 );
    DebugScreen();
}
コード例 #7
0
static image_entry *DoCreateImage( const char *exe, const char *symfile )
{
    image_entry         *image;
    image_entry         **owner;
    size_t              len;


    len = ( exe == NULL ) ? 0 : strlen( exe );
    _ChkAlloc( image, sizeof( *image ) + len, LIT_ENG( ERR_NO_MEMORY_FOR_DEBUG ) );
    if( image == NULL )
        return( NULL );
    memset( image, 0, sizeof( *image ) );
    if( len != 0 )
        memcpy( image->image_name, exe, len + 1 );
    if( symfile != NULL ) {
        _Alloc( image->symfile_name, strlen( symfile ) + 1 );
        if( image->symfile_name == NULL ) {
            _Free( image );
            Error( ERR_NONE, LIT_ENG( ERR_NO_MEMORY_FOR_DEBUG ) );
            return( NULL );
        }
        strcpy( image->symfile_name, symfile );
    }
    image->mapper = MapAddrSystem;
    for( owner = &DbgImageList; *owner != NULL; owner = &(*owner)->link )
        ;
    *owner = image;
    return( image );
}
コード例 #8
0
static image_entry *DoCreateImage( const char *exe, const char *symfile )
{
    image_entry         *image;
    image_entry         **owner;
    size_t              len;

    len = ( exe == NULL ) ? 0 : strlen( exe );
    _Alloc( image, sizeof( *image ) + len );
    if( image != NULL ) {
        memset( image, 0, sizeof( *image ) );
        if( len != 0 )
            memcpy( image->image_name, exe, len + 1 );
        if( symfile != NULL ) {
            _Alloc( image->symfile_name, strlen( symfile ) + 1 );
            if( image->symfile_name == NULL ) {
                _Free( image );
                image = NULL;
            } else {
                strcpy( image->symfile_name, symfile );
            }
        }
        if( image != NULL ) {
            image->mapper = MapAddrSystem;
            for( owner = &DbgImageList; *owner != NULL; owner = &(*owner)->link )
                ;
            *owner = image;
        }
    }
    return( image );
}
コード例 #9
0
ファイル: addarith.c プロジェクト: ABratovic/open-watcom-v2
void AddAliasInfo( unsigned seg, unsigned alias )
{
    alias_info          **owner;
    alias_info          *curr;

    if( alias == 0 ) {
        owner = &HeadAliasTbl;
        for( ;; ) {
            curr = *owner;
            if( curr == NULL ) break;
            if( curr->seg == seg ) {
                (*owner)->next = curr->next;
                _Free( curr );
                return;
            }
            owner = &curr->next;
        }
    } else {
        _Alloc( curr, sizeof( alias_info ) );
        if( curr != NULL ) {
            curr->seg = seg;
            curr->alias = alias;
            curr->next = HeadAliasTbl;
            HeadAliasTbl = curr;
        }
    }
}
コード例 #10
0
ファイル: dbgscan.c プロジェクト: Ukusbobra/open-watcom-v2
static void SetRadixSpec( char *str, unsigned len, unsigned radix, bool clear )
{

    rad_str   *pref;
    rad_str  **owner;

    owner = &RadStrs;
    pref = RadStrs;
    while( pref != NULL ) {
        if( pref->radstr[0] == len
         && memicmp( &pref->radstr[1], str, pref->radstr[0] ) == 0 ) break;
        if( pref->radstr[0] < len ) break;
        owner = &pref->next;
        pref = pref->next;
    }
    if( pref == NULL || pref->radstr[0] != len ) {
        if( clear ) return;
        pref = DbgMustAlloc( sizeof( rad_str ) + len );
        memcpy( &pref->radstr[1], str, len );
        pref->radstr[0] = len;
        pref->next = *owner;
        *owner = pref;
    } else if( clear ) {
        *owner = pref->next;
        _Free( pref );
        return;
    }
    pref->radval = radix;
}
コード例 #11
0
ファイル: pbc-lua.c プロジェクト: leabersocket/pbc
/*
	lightuserdata pattern
	string format "ixrsmb"
	integer size
 */
static int
_pattern_pack(lua_State *L) {
	struct pbc_pattern * pat = lua_touserdata(L,1);
	size_t format_sz = 0;
	const char * format = lua_tolstring(L,2,&format_sz);
	int size = lua_tointeger(L,3);

	char data[size];

	memset(data, 0 ,size);

	char * ptr = data;

	int i;

	for (i=0;i<format_sz;i++) {
		if (format[i] >= 'a' && format[i] <='z') {
			ptr = _get_value(L, 4+i, ptr, format[i]);
		} else {
			if (!lua_istable(L,4+i)) {
				luaL_error(L,"need table for array type");
			}
			int j;
			int n = lua_rawlen(L,4+i);
			for (j=0;j<n;j++) {
				lua_rawgeti(L,4+i,j);
				_get_array_value(L,(void *)ptr,format[i]);
				lua_pop(L,1);
			}
			ptr += sizeof(pbc_array);
		}
	}

	luaL_Buffer b;
	luaL_buffinit(L, &b);

	int cap = 128;
	do {
		char * temp = luaL_prepbuffsize(&b , cap);

		struct pbc_slice slice;
		slice.buffer = temp;
		slice.len = cap;

		int ret = pbc_pattern_pack(pat, data, &slice);

		if (ret < 0) {
			cap = cap * 2;
			_Free(temp);
			continue;
		}

		luaL_addsize(&b , slice.len);
	} while (0);
	luaL_pushresult(&b);

	pbc_pattern_close_arrays(pat, data);

	return 1;
}
コード例 #12
0
ファイル: lnxscrn.c プロジェクト: groessler/open-watcom-v2
void InitScreen( void )
{
    if( setpgid( 0, 0 ) != 0 && errno != EPERM ) {
        StartupErr( "unable to create new process group" );
    }
    if( TryTTY() ) {
        ConMode = C_TTY;
    } else if( TryVC() ) {
        ConMode = C_VC;
    } else if( TryXWindows() ) {
        ConMode = C_XWIN;
    } else {
        /* backup: just use the current terminal */
        ConMode = C_CURTTY;
        DbgConHandle = -1;
    }
    _Free( DbgTerminal );
    DbgTerminal = NULL;
    if ( DbgConHandle != -1 ) {
        fcntl( DbgConHandle, F_SETFD, (int)FD_CLOEXEC );
        UIConFile = fdopen( DbgConHandle, "w+" );
        UIConHandle = DbgConHandle;
    }
    if( !uistart() ) {
        StartupErr( "unable to initialize user interface" );
    }
    if( _IsOn( SW_USE_MOUSE ) ) {
        GUIInitMouse( 1 );
    }
    DebugScreen();
}
コード例 #13
0
 void Release()
 {
     if (m_p != INVALID_PTR)
     {
         _Free(m_p);
         m_p = INVALID_PTR;
     }
 }
コード例 #14
0
ファイル: GUIAlloc.c プロジェクト: Arakula/Misa-Kitara-AP
/*********************************************************************
*
*       GUI_ALLOC_Free
*/
void GUI_ALLOC_Free(GUI_HMEM hMem) {
  if (hMem == GUI_HMEM_NULL) { /* Note: This is not an error, it is permitted */
    return;
  }
  GUI_LOCK();
  GUI_DEBUG_LOG1("\nGUI_ALLOC_Free(%d)", hMem);
  _Free(hMem);
  GUI_UNLOCK();
}
コード例 #15
0
OVL_EXTERN void Profile( void )
{
    if( InvokeFile != NULL ) {
        ProfileInvoke( InvokeFile );
        _Free( InvokeFile );
        InvokeFile = NULL;
        ProcInput();
    }
}
コード例 #16
0
static void FreeParms( void )
{
    int         i;

    for( i = 0; i < MAX_PARMS; ++i ) {
        _Free( DefParms[i] );
        DefParms[i] = NULL;
    }
}
コード例 #17
0
ファイル: dbgutil.c プロジェクト: Azarien/open-watcom-v2
void FreeCmdList( cmd_list *cmds )
{
    if( cmds == NULL )
        return;
    cmds->use--;
    if( cmds->use == 0 ) {
        _Free( cmds );
    }
}
コード例 #18
0
ファイル: dbgscan.c プロジェクト: Ukusbobra/open-watcom-v2
void AddActualChar( char data )
{
    char    *hold, *walk1, *walk2;
    unsigned len;

    len = ++StringLength;
    _Alloc( hold, len );
    if( hold == NULL ) {
        _Free( StringStart );
        Error( ERR_NONE, LIT( ERR_NO_MEMORY_FOR_EXPR ) );
    }
    walk1 = hold;
    walk2 = StringStart;
    for( --len; len > 0; --len )  *walk1++ = *walk2++;
    *walk1 = data;
    _Free( StringStart );
    StringStart = hold;
}
コード例 #19
0
void FreeRing( char_ring *p )
{
    char_ring   *old;

    while( p != NULL ) {
        old = p;
        p = p->next;
        _Free( old );
    }
}
コード例 #20
0
ファイル: BufferMessage.cpp プロジェクト: xiaoyanit/vnoc
void CBufferMessage::Attach(IN void* lpBuff, IN uint32 nSize)
{
    if ((lpBuff != NULL) || nSize > 0)
    {
        _Free();
        m_attachtag = true;
        m_pBuffer = (uint8*)lpBuff;
        m_Size = nSize;
    }
}
コード例 #21
0
void SymCompFini( void )
{
    sorted_names        *curr, *next;
    for( curr = SortedNames; curr != NULL; curr = next ) {
        next = curr->next;
        NameListFree( &curr->list );
        _Free( curr );
    }
    SortedNames = NULL;
}
コード例 #22
0
ファイル: dbgscan.c プロジェクト: Ukusbobra/open-watcom-v2
void FiniScan( void )
{
    rad_str     *old;

    while( RadStrs != NULL ) {
        old = RadStrs;
        RadStrs = RadStrs->next;
        _Free( old );
    }
}
コード例 #23
0
ファイル: addarith.c プロジェクト: ABratovic/open-watcom-v2
void FreeAliasInfo( void )
{
    alias_info      *temp;

    while( HeadAliasTbl != NULL ) {
        temp = HeadAliasTbl->next;
        _Free( HeadAliasTbl );
        HeadAliasTbl = temp;
    }
}
コード例 #24
0
ファイル: Debug.cpp プロジェクト: wyrover/SICQ
//! Writes a binary data as a table to a debug screen buffer beginning at the current cursor location.
//! \param pData [in] a pointer to a binary data.
//! \param nDataSize [in] a size of the binary data.
//! \return the number of characters written to the debug
int _PrintDebugHEXTable(char *pData,int nDataSize)
{
	TCHAR *pszString=(TCHAR *)_Alloc(3*(sizeof(TCHAR))*(nDataSize+1));

	_BinToHEXTable(pData,nDataSize,pszString);

	int nResult=_PrintDebugText(pszString);

	_Free(pszString);

	return nResult;
}
コード例 #25
0
ファイル: dbgbrk.c プロジェクト: groessler/open-watcom-v2
void SetBPCondition( brkp *bp, const char *condition )
{
    if( bp->condition != NULL ) {
        _Free( bp->condition );
    }
    if( condition == NULL || condition[0] == '\0' ) {
        bp->condition = NULL;
    } else {
        bp->condition = DupStr( condition );
    }
    bp->status.b.use_condition = ( bp->condition != NULL );
}
コード例 #26
0
static void PushInitCmdList( void )
{
    cmd_list    *cmds;

    if( InitCmdList != NULL ) {
        cmds = AllocCmdList( InitCmdList, strlen( InitCmdList ) );
        _Free( InitCmdList );
        InitCmdList = NULL;
        PushCmdList( cmds );
        FreeCmdList( cmds );
    }
}
コード例 #27
0
ファイル: file_map.cpp プロジェクト: mariuz/haiku
/*!	Invalidates or removes the specified part of the file map.
*/
void
FileMap::Invalidate(fssh_off_t offset, fssh_off_t size)
{
	MutexLocker _(fLock);

	// TODO: honour size, we currently always remove everything after "offset"
	if (offset == 0) {
		_Free();
		return;
	}

	_InvalidateAfter(offset);
}
コード例 #28
0
ファイル: dbgcmdln.c プロジェクト: Azarien/open-watcom-v2
static void GetInitCmd( int pass )
{
    char    cmd[CMD_LEN];

    WantEquals();
    SkipSpaces();
    GetRawItem( cmd );
    if( pass == 2 ) {
        _Free( InitCmdList );
        _Alloc( InitCmdList, strlen( cmd ) + 1 );
        StrCopy( cmd, InitCmdList );
    }
}
コード例 #29
0
ファイル: dbgset.c プロジェクト: NoSuchProcess/open-watcom-v2
void NewLang( const char *lang )
{
    char       *new_lang;
    unsigned    len;

    if( lang == NULL )
        return;
    len = strlen( lang );
    new_lang = DbgMustAlloc( len + 1 );
    memcpy( new_lang, lang, len );
    new_lang[len] = NULLCHAR;
    strlwr( new_lang );
    if( ( len != strlen( Language ) ) || memcmp( new_lang, Language, len ) != 0 ) {
        if( LangLoad( new_lang, len ) ) {
            _Free( Language );
            Language = new_lang;
            return;
        }
        LangLoad( Language, strlen( Language ) );
        Error( ERR_NONE, LIT_ENG( ERR_NO_LANG ) );
    }
    _Free( new_lang );
}
コード例 #30
0
ファイル: dbgsrc.c プロジェクト: Azarien/open-watcom-v2
void DeleteRing( char_ring **owner, const char *start, unsigned len, bool ucase )
{
    char_ring *p;

    if( len != 0 ) {
        for( ; (p = *owner) != NULL; owner = &p->next ) {
            if( ucase && strnicmp( p->name, start, len ) == 0
              || !ucase && strncmp( p->name, start, len ) == 0 ) {
                *owner = p->next;
                _Free( p );
                break;
            }
        }
    }
}