WinDBG/Exts/CodeAnalyzer/gdbplus/gdb-1824/src/gdb/gdb_dep.c
// return false if the address is already in the map, or invalid params
return false if the address is already in the map, or invalid params
return false if the address is already in the map or invalid params
static CA_BOOL
add_addr_type(address_t addr, struct type* type, struct symbol* sym)
{
	int i;
	for (i = 0; i< addr_type_map_sz; i++)
	{
		if (addr >= addr_type_map[i].addr && addr < addr_type_map[i].addr + addr_type_map[i].size)
			return CA_FALSE;
	}
	if (addr_type_map_sz >= addr_type_map_buf_sz)
	{
		if (addr_type_map_buf_sz == 0)
			addr_type_map_buf_sz = 64;
		else
			addr_type_map_buf_sz = addr_type_map_buf_sz * 2;
		addr_type_map = realloc(addr_type_map, addr_type_map_buf_sz * sizeof(struct ca_addr_type_pair));
	}
	addr_type_map[addr_type_map_sz].addr = addr;
	if (sym)
	{
		type = SYMBOL_TYPE(sym);
		CHECK_TYPEDEF(type);
		if (TYPE_CODE(type) == TYPE_CODE_PTR || TYPE_CODE(type) == TYPE_CODE_REF)
			type = TYPE_TARGET_TYPE (type);
		addr_type_map[addr_type_map_sz].type = type;
		addr_type_map[addr_type_map_sz].sym = sym;
		addr_type_map[addr_type_map_sz].size = TYPE_LENGTH(type);
	}
	else if (type)
	{
		CHECK_TYPEDEF(type);
		addr_type_map[addr_type_map_sz].type = type;
		addr_type_map[addr_type_map_sz].sym = NULL;
		addr_type_map[addr_type_map_sz].size = TYPE_LENGTH(type);
	}
	else
		return CA_FALSE;
	addr_type_map_sz++;
	return CA_TRUE;
}
static CA_BOOL add_addr_type ( address_t addr , struct type * type , struct symbol * sym ) { int i ; for ( i = 0 ; i < addr_type_map_sz ; i ++ ) { if ( addr >= addr_type_map [ i ] . addr && addr < addr_type_map [ i ] . addr + addr_type_map [ i ] . size ) return CA_FALSE ; } if ( addr_type_map_sz >= addr_type_map_buf_sz ) { if ( addr_type_map_buf_sz == 0 ) addr_type_map_buf_sz = 64 ; else addr_type_map_buf_sz = addr_type_map_buf_sz * 2 ; addr_type_map = realloc ( addr_type_map , addr_type_map_buf_sz * sizeof ( struct ca_addr_type_pair ) ) ; } addr_type_map [ addr_type_map_sz ] . addr = addr ; if ( sym ) { type = SYMBOL_TYPE ( sym ) ; CHECK_TYPEDEF ( type ) ; if ( TYPE_CODE ( type ) == TYPE_CODE_PTR || TYPE_CODE ( type ) == TYPE_CODE_REF ) type = TYPE_TARGET_TYPE ( type ) ; addr_type_map [ addr_type_map_sz ] . type = type ; addr_type_map [ addr_type_map_sz ] . sym = sym ; addr_type_map [ addr_type_map_sz ] . size = TYPE_LENGTH ( type ) ; } else if ( type ) { CHECK_TYPEDEF ( type ) ; addr_type_map [ addr_type_map_sz ] . type = type ; addr_type_map [ addr_type_map_sz ] . sym = NULL ; addr_type_map [ addr_type_map_sz ] . size = TYPE_LENGTH ( type ) ; } else return CA_FALSE ; addr_type_map_sz ++ ; return CA_TRUE ; }
return false if the address is already in the map, or invalid params
return false if the address is already in the map or invalid params
// check duplicate entry