Lines Matching refs:region
42 region_type *region;
96 // but grows if needed. There is a separate region for each mmap
98 // files. In addition, there is a region for the main executable
149 // within each region because the symbols are sometimes shared
152 // region symbols in its destructor. We need to free only the
153 // regions and the array of region pointers.
155 // Each region is also reference-counted. The count is zero
156 // if no other processes are sharing this region.
226 void AddPredefinedRegion(region_type *region, const char *path,
229 void InitRegionSymbols(region_type *region, int nsymbols);
230 void AddRegionSymbol(region_type *region, int idx,
235 bool ReadElfSymbols(region_type *region, uint32_t flags);
236 void AddRegion(ProcessState *pstate, region_type *region);
247 region_type *region);
301 region_type *region = ptr->value;
302 // If the symbols are not shared with another region, then delete them.
303 if ((region->flags & region_type::kSharedSymbols) == 0) {
304 int nsymbols = region->nsymbols;
306 delete[] region->symbols[ii].name;
308 delete[] region->symbols;
310 delete[] region->path;
312 // Do not delete the region itself here. Each region
318 // Delete the ProcessState objects after the region symbols in
319 // the hash table above so that we still have valid region pointers
320 // when deleting the region symbols.
365 // This function is used by the qsort() routine to sort region entries
390 region_type *region = ptr->value;
391 nsyms += region->nsymbols;
401 region_type *region = ptr->value;
402 memcpy(next_sym, region->symbols, region->nsymbols * sizeof(symbol_type));
403 next_sym += region->nsymbols;
459 void TraceReader<T>::AddPredefinedRegion(region_type *region, const char *path,
465 region->path = new char[len + 1];
466 strcpy(region->path, path);
467 region->vstart = vstart;
468 region->vend = vend;
469 region->base_addr = base;
470 region
474 void TraceReader<T>::InitRegionSymbols(region_type *region, int nsymbols)
476 region->nsymbols = nsymbols;
477 region->symbols = new symbol_type[nsymbols];
478 memset(region->symbols, 0, nsymbols * sizeof(symbol_type));
482 void TraceReader<T>::AddRegionSymbol(region_type *region, int idx,
486 region->symbols[idx].addr = addr;
487 region->symbols[idx].name = Strdup(name);
488 region->symbols[idx].vm_sym = NULL;
489 region->symbols[idx].region = region;
490 region->symbols[idx].flags = flags;
496 region_type *region = new region_type;
497 AddPredefinedRegion(region, "(bootloader)", 0, 0x14, 0);
498 InitRegionSymbols(region, 2);
499 AddRegionSymbol(region, 0, 0, "(bootloader_start)", 0);
500 AddRegionSymbol(region, 1, 0x14, "(bootloader_end)", 0);
501 AddRegion(pstate, region);
502 hash_->Update(region->path, region);
504 region = new region_type;
505 AddPredefinedRegion(region, "(exception vectors)", 0xffff0000, 0xffff0500,
507 InitRegionSymbols(region, 2);
508 AddRegionSymbol(region, 0, 0x0, "(vector_start)",
510 AddRegionSymbol(region, 1, 0x500, "(vector_end)", 0);
511 AddRegion(pstate, region);
512 hash_->Update(region->path, region);
514 region = new region_type;
515 AddPredefinedRegion(region, "(atomic ops)", 0xffff0f80, 0xffff1000,
517 // Mark this region as also being mapped in user-space.
520 region->flags |= region_type::kIsUserMappedRegion;
522 InitRegionSymbols(region, 4);
523 AddRegionSymbol(region, 0, 0x0, "(kuser_atomic_inc)", 0);
524 AddRegionSymbol(region, 1, 0x20, "(kuser_atomic_dec)", 0);
525 AddRegionSymbol(region, 2, 0x40, "(kuser_cmpxchg)", 0);
526 AddRegionSymbol(region, 3, 0x80, "(kuser_end)", 0);
527 AddRegion(pstate, region);
528 hash_->Update(region->path, region);
534 region_type *region = new region_type;
537 region->path = new char[len + 1];
538 strcpy(region->path, kernel_file);
539 region->flags = region_type::kIsKernelRegion;
540 ReadElfSymbols(region, kIncludeLocalSymbols);
541 region->vend = 0xffff0000;
542 AddRegion(processes_[0], region);
544 hash_->Update(region->path, region);
581 bool TraceReader<T>::ReadElfSymbols(region_type *region, uint32_t flags)
592 strcat(full_path, region->path);
598 // an empty region
599 region->vstart = 0;
600 region->nsymbols = 1;
601 region->symbols = new symbol_type[1];
602 memset(region->symbols, 0, sizeof(symbol_type));
604 region->symbols[0].addr = 0;
605 region->symbols[0].name = Strdup("(unknown)");
606 region->symbols[0].vm_sym = NULL;
607 region->symbols[0].region = region;
608 region->symbols[0].flags = 0;
669 char *cp = strrchr(region->path, '/');
675 cp = region->path;
771 int len = strlen(region->path);
774 strcpy(name, region->path);
780 char *cp = strrchr(region->path, '/');
786 cp = region->path;
804 // Assign the region pointers
806 functions[ii].region = region;
853 if (region->vstart == 0)
854 region->vstart = min_addr;
855 region->nsymbols = nfuncs;
856 region->symbols = functions;
859 printf("%s num symbols: %d min_addr: 0x%x\n", region->path, nfuncs, min_addr);
919 void TraceReader<T>::AddRegion(ProcessState *pstate, region_type *region)
942 // Add the new region to the end of the array and resort
943 manager->regions[nregions] = region;
958 region_type *region = manager->regions[index];
960 // If the region does not contain [vstart,vend], then return.
961 if (vstart < region->vstart || vend > region->vend)
964 // If the existing region exactly matches the address range [vstart,vend]
965 // then remove the whole region.
966 if (vstart == region->vstart && vend == region->vend) {
968 if (region->refs == 0) {
969 // Free the region
970 hash_->Remove(region->path);
971 delete region;
973 region->refs -= 1;
977 // Assign the region at the end of the array to this empty slot
988 // If the existing region contains the given range and ends at the
990 // truncate the existing region so that it ends at vstart (because
992 if (vstart > region->vstart && vend == region->vend) {
995 if (region->refs == 0) {
996 // This region is not shared, so truncate it directly
997 truncated = region;
999 // This region is shared, so make a copy that we can truncate
1000 region->refs -= 1;
1001 truncated = region->MakePrivateCopy(new region_type);
1058 // the closest region address that is less than the given address.
1082 // the closest region address that is less than the given address.
1122 uint32_t vstart = cached_func_->region->vstart;
1123 uint32_t vend = cached_func_->region->vend;
1125 uint32_t sym_addr = addr - cached_func_->region->base_addr;
1150 region_type *region = FindRegion(addr, manager->nregions, manager->regions);
1151 uint32_t sym_addr = addr - region->base_addr;
1153 cached_func_ = FindFunction(sym_addr, region->nsymbols, region->symbols,
1156 cached_func_->region = region;
1261 region_type *region;
1267 // Create a new region and add it to the current process'
1269 region = new region_type;
1273 region->path = event->path;
1274 region->vstart = event->vstart;
1275 region->vend = event->vend;
1276 region->file_offset = event->offset;
1280 PopulateSymbolsFromDexFile(dexfile, region);
1282 ReadElfSymbols(region, 0);
1284 hash_->Update(region->path, region);
1286 region->nsymbols = existing_region->nsymbols;
1287 region->symbols = existing_region->symbols;
1288 region->flags |= region_type::kSharedSymbols;
1296 if (region->nsymbols > 2 && region->symbols[1].addr < event->vstart)
1297 region->base_addr = event->vstart;
1302 region->flags |= region_type::kIsLibraryRegion;
1307 region->path, region->vstart, region->vend, region->file_offset);
1310 region = existing_region;
1311 region->refs += 1;
1314 AddRegion(current_, region);
1461 region_type *region = FindRegion(addr, manager->nregions, manager->regions);
1462 uint32_t sym_addr = addr - region->base_addr;
1463 symbol_type *sym = FindFunction(sym_addr, region->nsymbols,
1464 region->symbols, true /* exact match */);
1468 sym->region = region;
1507 region_type *region)
1512 region->nsymbols = nsymbols + 1;
1515 region->symbols = symbols;
1520 symbols[ii].region = region;
1530 symbol->region = region;