Lines Matching refs:di
119 /* Find 'di' in the debugInfo_list and move it one step closer the the
124 static void move_DebugInfo_one_step_forward ( DebugInfo* di )
127 if (di == debugInfo_list)
129 vg_assert(di != NULL);
134 if (di0 == NULL || di0 == di) break;
139 vg_assert(di0 == di);
142 /* di0 points to di, di1 to its predecessor, and di2 to di1's
179 DebugInfo* di;
183 di = ML_(dinfo_zalloc)("di.debuginfo.aDI.1", sizeof(DebugInfo));
184 di->handle = handle_counter++;
185 di->filename = ML_(dinfo_strdup)("di.debuginfo.aDI.2", filename);
186 di->memname = memname ? ML_(dinfo_strdup)("di.debuginfo.aDI.3", memname)
196 di->trace_symtab = VG_(clo_trace_symtab);
197 di->trace_cfi = VG_(clo_trace_cfi);
198 di->ddump_syms = VG_(clo_debug_dump_syms);
199 di->ddump_line = VG_(clo_debug_dump_line);
200 di->ddump_frames = VG_(clo_debug_dump_frames);
203 return di;
208 static void free_DebugInfo ( DebugInfo* di )
215 vg_assert(di != NULL);
216 if (di->filename) ML_(dinfo_free)(di->filename);
217 if (di->symtab) ML_(dinfo_free)(di->symtab);
218 if (di->loctab) ML_(dinfo_free)(di->loctab);
219 if (di->cfsi) ML_(dinfo_free)(di->cfsi);
220 if (di->cfsi_exprs) VG_(deleteXA)(di->cfsi_exprs);
221 if (di->fpo) ML_(dinfo_free)(di->fpo);
223 for (chunk = di->strchunks; chunk != NULL; chunk = next) {
231 if (di->admin_tyents) {
232 n = VG_(sizeXA)(di->admin_tyents);
234 ent = (TyEnt*)VG_(indexXA)(di->admin_tyents, i);
238 VG_(deleteXA)(di->admin_tyents);
239 di->admin_tyents = NULL;
242 if (di->admin_gexprs) {
243 n = VG_(sizeXA)(di->admin_gexprs);
245 gexpr = *(GExpr**)VG_(indexXA)(di->admin_gexprs, i);
248 VG_(deleteXA)(di->admin_gexprs);
249 di->admin_gexprs = NULL;
256 if (di->varinfo) {
257 for (i = 0; i < VG_(sizeXA)(di->varinfo); i++) {
258 OSet* scope = *(OSet**)VG_(indexXA)(di->varinfo, i);
280 VG_(deleteXA)(di->varinfo);
283 ML_(dinfo_free)(di);
291 static void discard_DebugInfo ( DebugInfo* di )
305 if (curr == di) {
311 di->text_avma,
312 di->text_avma + di->text_size,
452 DebugInfo* di;
457 for (di = debugInfo_list; di; di = di->next) {
458 di->mark = do_DebugInfos_overlap( di, diRef );
459 if (di == diRef) {
460 vg_assert(di->mark);
461 di->mark = False;
475 DebugInfo* di;
477 for (di = debugInfo_list; di; di = di->next) {
478 vg_assert(di->filename);
479 if (0==VG_(strcmp)(di->filename, filename)
480 && ( (memname && di->memname)
481 ? 0==VG_(strcmp)(memname, di->memname)
485 if (!di) {
486 di = alloc_DebugInfo(filename, memname);
487 vg_assert(di);
488 di->next = debugInfo_list;
489 debugInfo_list = di;
491 return di;
495 /* Debuginfo reading for 'di' has just been successfully completed.
499 static void check_CFSI_related_invariants ( DebugInfo* di )
502 vg_assert(di);
506 di->have_rx_map);
507 vg_assert(di->have_rw_map);
509 if (di->rx_map_size == 0) {
510 vg_assert(di->cfsi == NULL);
515 vg_assert(di->rx_map_size > 0);
518 if (di2 == di)
522 vg_assert(di->rx_map_avma + di->rx_map_size <= di2->rx_map_avma
523 || di2->rx_map_avma + di2->rx_map_size <= di->rx_map_avma);
527 if (di->cfsi) {
528 vg_assert(di->cfsi_minavma <= di->cfsi_maxavma); /* duh! */
529 vg_assert(di->cfsi_minavma >= di->rx_map_avma);
530 vg_assert(di->cfsi_maxavma < di->rx_map_avma + di->rx_map_size);
533 if (di->cfsi) {
535 vg_assert(di->cfsi_used > 0);
536 vg_assert(di->cfsi_size > 0);
537 for (i = 0; i < di->cfsi_used; i++) {
538 DiCfSI* cfsi = &di->cfsi[i];
540 vg_assert(cfsi->base >= di->cfsi_minavma);
541 vg_assert(cfsi->base + cfsi->len - 1 <= di->cfsi_maxavma);
543 DiCfSI* cfsip = &di->cfsi[i-1];
548 vg_assert(di->cfsi_used == 0);
549 vg_assert(di->cfsi_size == 0);
608 DebugInfo *di;
616 di = find_or_create_DebugInfo_for(nacl_file, NULL);
617 vg_assert(di);
619 // di->trace_symtab = 1;
633 di->have_rx_map = True;
634 di->rx_map_avma = nacl_head;
635 di->rx_map_size = FOURGIG;
636 di->rx_map_foff = 0;
637 di->have_rw_map = True;
638 di->rw_map_avma = nacl_head;
639 di->rw_map_size = FOURGIG;
640 di->rw_map_foff = rw_start - nacl_head;
642 discard_DebugInfos_which_overlap_with( di );
643 if (ML_(read_elf_debug_info)(di)) {
644 di->soname = "NaCl";
650 ML_(canonicaliseTables)( di );
653 VG_(redir_notify_new_DebugInfo)( di );
655 di->have_dinfo = True;
656 vg_assert(di->handle > 0);
660 check_CFSI_related_invariants(di);
674 DebugInfo* di;
843 di = find_or_create_DebugInfo_for( filename, NULL/*membername*/ );
844 vg_assert(di);
848 if (!di->have_rx_map) {
849 di->have_rx_map = True;
850 di->rx_map_avma = a;
851 di->rx_map_size = seg->end + 1 - seg->start;
852 di->rx_map_foff = seg->offset;
860 if (!di->have_rw_map) {
861 di->have_rw_map = True;
862 di->rw_map_avma = a;
863 di->rw_map_size = seg->end + 1 - seg->start;
864 di->rw_map_foff = seg->offset;
873 if ( ! (di->have_rx_map && di->have_rw_map && !di->have_dinfo) )
877 vg_assert(di->filename);
881 TRACE_SYMTAB("------ name = %s\n", di->filename);
888 discard_DebugInfos_which_overlap_with( di );
893 ok = ML_(read_elf_debug_info)( di );
895 ok = ML_(read_macho_debug_info)( di );
907 ML_(canonicaliseTables)( di );
910 VG_(redir_notify_new_DebugInfo)( di );
912 di->have_dinfo = True;
913 tl_assert(di->handle > 0);
914 di_handle = di->handle;
918 check_CFSI_related_invariants(di);
926 vg_assert(di->have_dinfo == False);
930 TRACE_SYMTAB("------ name = %s\n", di->filename);
1048 HChar* mashed = ML_(dinfo_zalloc)("di.debuginfo.dnpdi.1", mashedSzB);
1060 HChar* mashed = ML_(dinfo_zalloc)("di.debuginfo.dnpdi.2", mashedSzB);
1082 pdbname = ML_(dinfo_zalloc)("di.debuginfo.lpd1", sz_exename+5);
1150 DebugInfo* di = find_or_create_DebugInfo_for(exename, NULL/*membername*/ );
1152 /* this di must be new, since we just nuked any old stuff in the range */
1153 vg_assert(di && !di->have_rx_map && !di->have_rw_map);
1154 vg_assert(!di->have_dinfo);
1156 /* don't set up any of the di-> fields; let
1158 ML_(read_pdb_debug_info)( di, avma_obj, unknown_purpose__reloc,
1162 vg_assert(di->have_dinfo); // fails if PDB read failed
1206 DebugInfo* di;
1207 di = find_or_create_DebugInfo_for( file_name, mem_name );
1208 vg_assert(di);
1211 di->text_present = True;
1212 di->text_svma = 0; /* don't know yet */
1213 di->text_bias = 0; /* don't know yet */
1214 di->text_avma = code_start;
1215 di->text_size = code_len;
1218 di->data_present = True;
1219 di->data_svma = 0; /* don't know yet */
1220 di->data_bias = 0; /* don't know yet */
1221 di->data_avma = data_start;
1222 di->data_size = data_len;
1228 di->have_rx_map = True;
1229 di->rx_map_avma = code_start;
1230 di->rx_map_size = code_len;
1231 di->have_rw_map = True;
1232 di->rw_map_avma = data_start;
1233 di->rw_map_size = data_len;
1235 ok = ML_(read_xcoff_debug_info) ( di, is_mainexe );
1239 ML_(canonicaliseTables)( di );
1241 VG_(redir_notify_new_DebugInfo)( di );
1243 di->have_dinfo = True;
1244 hdl = di->handle;
1249 check_CFSI_related_invariants(di);
1252 discard_DebugInfo( di );
1253 di = NULL;
1283 DebugInfo *di, *di2;
1284 di = debugInfo_list;
1285 while (di) {
1286 di2 = di->next;
1287 VG_(printf)("XXX rm %p\n", di);
1288 free_DebugInfo( di );
1289 di = di2;
1311 DebugInfo* di;
1314 for (di = debugInfo_list; di != NULL; di = di->next) {
1320 inRange = di->have_rx_map
1321 && di->rx_map_size > 0
1322 && di->rx_map_avma <= ptr
1323 && ptr < di->rx_map_avma + di->rx_map_size;
1325 inRange = (di->data_present
1326 && di->data_size > 0
1327 && di->data_avma <= ptr
1328 && ptr < di->data_avma + di->data_size)
1330 (di->sdata_present
1331 && di->sdata_size > 0
1332 && di->sdata_avma <= ptr
1333 && ptr < di->sdata_avma + di->sdata_size)
1335 (di->bss_present
1336 && di->bss_size > 0
1337 && di->bss_avma <= ptr
1338 && ptr < di->bss_avma + di->bss_size)
1340 (di->sbss_present
1341 && di->sbss_size > 0
1342 && di->sbss_avma <= ptr
1343 && ptr < di->sbss_avma + di->sbss_size)
1345 (di->rodata_present
1346 && di->rodata_size > 0
1347 && di->rodata_avma <= ptr
1348 && ptr < di->rodata_avma + di->rodata_size);
1354 di, ptr, match_anywhere_in_sym, findText );
1357 *pdi = di;
1373 DebugInfo* di;
1374 for (di = debugInfo_list; di != NULL; di = di->next) {
1375 if (di->text_present
1376 && di->text_size > 0
1377 && di->text_avma <= ptr
1378 && ptr < di->text_avma + di->text_size) {
1379 lno = ML_(search_one_loctab) ( di, ptr );
1382 *pdi = di;
1405 DebugInfo* di;
1409 search_all_symtabs ( a, &di, &sno, match_anywhere_in_sym, findText );
1410 if (di == NULL)
1414 di->symtab[sno].name, buf, nbuf );
1426 offset = a - di->symtab[sno].addr;
1606 DebugInfo* di;
1612 for (di = debugInfo_list; di != NULL; di = di->next) {
1613 if (di->text_present
1614 && di->text_size > 0
1615 && di->text_avma <= a
1616 && a < di->text_avma + di->text_size) {
1617 VG_(strncpy_safely)(buf, di->filename, nbuf);
1618 if (di->memname) {
1624 VG_(strncpy_safely)(&buf[used], di->memname, nbuf-used);
1651 DebugInfo* di;
1653 for (di = debugInfo_list; di != NULL; di = di->next) {
1654 if (di->text_present
1655 && di->text_size > 0
1656 && di->text_avma <= a
1657 && a < di->text_avma + di->text_size) {
1659 move_DebugInfo_one_step_forward( di );
1660 return di;
2092 DebugInfo* di;
2101 for (di = debugInfo_list; di != NULL; di = di->next) {
2107 if (di->cfsi_used == 0)
2109 if (ip < di->cfsi_minavma || ip > di->cfsi_maxavma)
2113 j = ML_(search_one_cfitab)( di, ip );
2114 vg_assert(j >= -1 && j < (Word)di->cfsi_used);
2131 /* ensure that di is 4-aligned (at least), so it can't possibly
2133 vg_assert(di && VG_IS_4_ALIGNED(di));
2134 vg_assert(i >= 0 && i < di->cfsi_used);
2135 *diP = di;
2146 /* Move di one step closer to the start of the list. */
2147 move_DebugInfo_one_step_forward( di );
2164 Each cache entry binds an ip value to a (di, ix) pair. Possible
2167 di is non-null, ix >= 0 ==> cache slot in use, "di->cfsi[ix]"
2168 di is (DebugInfo*)1 ==> cache slot in use, no associated di
2169 di is NULL ==> cache slot not in use
2185 struct { Addr ip; DebugInfo* di; Word ix; }
2205 if (LIKELY(ce->ip == ip) && LIKELY(ce->di != NULL)) {
2211 find_DiCfSI( &ce->di, &ce->ix, ip );
2214 if (UNLIKELY(ce->di == (DebugInfo*)1)) {
2227 DebugInfo* di, DiCfSI* cfsi )
2263 ML_(ppCfiExpr)(di->cfsi_exprs, cfsi->cfa_off);
2270 cfa = evalCfiExpr(di->cfsi_exprs, cfsi->cfa_off, &eec, &ok );
2287 DebugInfo* di;
2295 di = ce->di;
2296 cfsi = &di->cfsi[ ce->ix ];
2306 min_accessible, max_accessible, di, cfsi);
2329 DebugInfo* di;
2349 di = ce->di;
2350 cfsi = &di->cfsi[ ce->ix ];
2354 ML_(ppDiCfSI)(di->cfsi_exprs, cfsi);
2361 min_accessible, max_accessible, di, cfsi);
2388 ML_(ppCfiExpr)(di->cfsi_exprs,_off); \
2393 _prev = evalCfiExpr(di->cfsi_exprs, _off, &eec, &ok ); \
2438 DebugInfo* di;
2448 for (di = debugInfo_list; di != NULL; di = di->next) {
2453 if (di->fpo == NULL)
2455 if (*ipP < di->fpo_minavma || *ipP > di->fpo_maxavma)
2458 i = ML_(search_one_fpotab)( di, *ipP );
2464 *ipP, di->fpo_size, i);
2465 for (j = 0; j < di->fpo_size; j++)
2467 j, di->fpo[j].ulOffStart, di->fpo[j].cbProcSize);
2469 vg_assert(i >= 0 && i < di->fpo_size);
2470 fpo = &di->fpo[i];
2492 //move_DebugInfo_one_step_forward( di );
2582 const DebugInfo* di )
2619 res = ML_(evaluate_GX)( var->gexpr, var->fbGX, regs, di );
2937 DebugInfo* di;
2947 for (di = debugInfo_list; di; di = di->next) {
2950 if (!di->text_present || di->text_size == 0)
2953 if (di->text_avma <= ip && ip < di->text_avma + di->text_size)
2960 if (!di)
2973 move_DebugInfo_one_step_forward( di );
2978 if (!di->varinfo)
2991 for (i = VG_(sizeXA)(di->varinfo) - 1; i >= 1; i--) {
2996 = *(OSet**)VG_(indexXA)( di->varinfo, i );
3031 if (data_address_is_in_var( &offset, di->admin_tyents,
3033 data_addr, di )) {
3036 di->admin_tyents,
3076 DebugInfo* di;
3087 for (di = debugInfo_list; di != NULL; di = di->next) {
3096 if (!di->text_present || di->text_size == 0)
3099 if (!di->varinfo)
3102 if (VG_(sizeXA)( di->varinfo ) == 0)
3104 global_scope = *(OSet**)VG_(indexXA)( di->varinfo, 0 );
3139 if (data_address_is_in_var( &offset, di->admin_tyents, var,
3141 data_addr, di )) {
3144 di->admin_tyents,
3272 Addr ip, const DebugInfo* di, DiVariable* var,
3317 res_sp_6k = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di );
3322 res_sp_7k = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di );
3327 res_fp_6k = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di );
3332 res_fp_7k = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di );
3354 res = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di );
3373 res = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di );
3405 DebugInfo* di;
3409 XArray* res = VG_(newXA)( ML_(dinfo_zalloc), "di.debuginfo.dgsbai.1",
3419 for (di = debugInfo_list; di; di = di->next) {
3422 if (!di->text_present || di->text_size == 0)
3425 if (di->text_avma <= ip && ip < di->text_avma + di->text_size)
3432 if (!di)
3445 move_DebugInfo_one_step_forward( di );
3450 if (!di->varinfo)
3463 for (i = VG_(sizeXA)(di->varinfo) - 1; i >= 1; i--) {
3468 = *(OSet**)VG_(indexXA)( di->varinfo, i );
3502 analyse_deps( res, di->admin_tyents, ip,
3503 di, var, arrays_only );
3524 DebugInfo* di;
3531 for (di = debugInfo_list; di; di = di->next) {
3532 if (di->handle == di_handle)
3539 tl_assert(di != NULL);
3542 gvars = VG_(newXA)( ML_(dinfo_zalloc), "di.debuginfo.dggbfd.1",
3547 if (!di->varinfo)
3553 nScopes = VG_(sizeXA)( di->varinfo );
3559 = *(OSet**)VG_(indexXA)( di->varinfo, scopeIx );
3586 res = ML_(evaluate_trivial_GX)( var->gexpr, di );
3599 mul = ML_(sizeOfType)(di->admin_tyents, var->typeR);
3612 ty = ML_(TyEnts__index_by_cuOff)( di->admin_tyents, NULL,
3624 tl_assert(di->soname);
3633 VG_(strncpy)(&gb.soname[0], di->soname, sizeof(gb.soname)-1);
3653 const DebugInfo* VG_(next_DebugInfo)(const DebugInfo* di)
3655 if (di == NULL)
3657 return di->next;
3660 Addr VG_(DebugInfo_get_text_avma)(const DebugInfo* di)
3662 return di->text_present ? di->text_avma : 0;
3665 SizeT VG_(DebugInfo_get_text_size)(const DebugInfo* di)
3667 return di->text_present ? di->text_size : 0;
3670 Addr VG_(DebugInfo_get_plt_avma)(const DebugInfo* di)
3672 return di->plt_present ? di->plt_avma : 0;
3675 SizeT VG_(DebugInfo_get_plt_size)(const DebugInfo* di)
3677 return di->plt_present ? di->plt_size : 0;
3680 Addr VG_(DebugInfo_get_gotplt_avma)(const DebugInfo* di)
3682 return di->gotplt_present ? di->gotplt_avma : 0;
3685 SizeT VG_(DebugInfo_get_gotplt_size)(const DebugInfo* di)
3687 return di->gotplt_present ? di->gotplt_size : 0;
3690 const UChar* VG_(DebugInfo_get_soname)(const DebugInfo* di)
3692 return di->soname;
3695 const UChar* VG_(DebugInfo_get_filename)(const DebugInfo* di)
3697 return di->filename;
3700 PtrdiffT VG_(DebugInfo_get_text_bias)(const DebugInfo* di)
3702 return di->text_present ? di->text_bias : 0;
3758 DebugInfo* di;
3761 for (di = debugInfo_list; di != NULL; di = di->next) {
3765 "addr=%#lx di=%p %s got=%#lx,%ld plt=%#lx,%ld "
3767 a, di, di->filename,
3768 di->got_avma, di->got_size,
3769 di->plt_avma, di->plt_size,
3770 di->data_avma, di->data_size,
3771 di->bss_avma, di->bss_size);
3773 if (di->text_present
3774 && di->text_size > 0
3775 && a >= di->text_avma && a < di->text_avma + di->text_size) {
3779 if (di->data_present
3780 && di->data_size > 0
3781 && a >= di->data_avma && a < di->data_avma + di->data_size) {
3785 if (di->sdata_present
3786 && di->sdata_size > 0
3787 && a >= di->sdata_avma && a < di->sdata_avma + di->sdata_size) {
3791 if (di->bss_present
3792 && di->bss_size > 0
3793 && a >= di->bss_avma && a < di->bss_avma + di->bss_size) {
3797 if (di->sbss_present
3798 && di->sbss_size > 0
3799 && a >= di->sbss_avma && a < di->sbss_avma + di->sbss_size) {
3803 if (di->plt_present
3804 && di->plt_size > 0
3805 && a >= di->plt_avma && a < di->plt_avma + di->plt_size) {
3809 if (di->got_present
3810 && di->got_size > 0
3811 && a >= didi->got_avma + di->got_size) {
3815 if (di->gotplt_present
3816 && di->gotplt_size > 0
3817 && a >= di->gotplt_avma && a < di->gotplt_avma + di->gotplt_size) {
3821 if (di->opd_present
3822 && di->opd_size > 0
3823 && a >= di->opd_avma && a < di->opd_avma + di->opd_size) {
3830 vg_assert( (di == NULL && res == Vg_SectUnknown)
3831 || (di != NULL && res != Vg_SectUnknown) );
3837 if (di && di->filename) {
3839 Int fnlen = VG_(strlen)(di->filename);
3847 name[j] = di->filename[i];
3848 if (di->filename[i] == 0) break;