From: Nicholas Nethercote Date: Sat, 14 May 2005 18:42:26 +0000 (+0000) Subject: Renamed the field Segment.symtab to Segment.seginfo to avoid confusion X-Git-Tag: svn/VALGRIND_3_0_0~609 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0367213e2dcfb6eeb05c05c68242b3cb94c725e5;p=thirdparty%2Fvalgrind.git Renamed the field Segment.symtab to Segment.seginfo to avoid confusion with SegInfo.symtab. Also renamed VG_(symtab_{inc,dec}ref)() as VG_(seginfo_{inc,dec}ref)() for the same reason. Also renamed various SegInfo variables from "seg" to "si" to avoid confusion with the many Segment variables called "seg". git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3709 --- diff --git a/coregrind/core.h b/coregrind/core.h index 4eb61c5e8d..8e67b44e6d 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -642,8 +642,8 @@ typedef struct _CodeRedirect CodeRedirect; extern Bool VG_(is_object_file) ( const void *hdr ); extern SegInfo * VG_(read_seg_symbols) ( Segment *seg ); -extern void VG_(symtab_incref) ( SegInfo * ); -extern void VG_(symtab_decref) ( SegInfo *, Addr a ); +extern void VG_(seginfo_incref) ( SegInfo * ); +extern void VG_(seginfo_decref) ( SegInfo *, Addr a ); extern Bool VG_(get_fnname_nodemangle)( Addr a, Char* fnname, Int n_fnname ); diff --git a/coregrind/m_aspacemgr/aspacemgr.c b/coregrind/m_aspacemgr/aspacemgr.c index 57bc6ae396..4e609e02c1 100644 --- a/coregrind/m_aspacemgr/aspacemgr.c +++ b/coregrind/m_aspacemgr/aspacemgr.c @@ -278,7 +278,7 @@ static void zeroise_segment ( Int i ) segments[i].fnIdx = -1; segments[i].dev = 0; segments[i].ino = 0; - segments[i].symtab = NULL; + segments[i].seginfo = NULL; } @@ -386,7 +386,7 @@ static inline Bool segments_are_mergeable(Segment *s1, Segment *s2) if (s1->prot != s2->prot) return False; - if (s1->symtab != s2->symtab) + if (s1->seginfo != s2->seginfo) return False; if (s1->flags & SF_FILE){ @@ -520,9 +520,9 @@ static void recycleseg(Segment *s) static void freeseg(Segment *s) { recycleseg(s); - if (s->symtab != NULL) { - VG_(symtab_decref)(s->symtab, s->addr); - s->symtab = NULL; + if (s->seginfo != NULL) { + VG_(seginfo_decref)(s->seginfo, s->addr); + s->seginfo = NULL; } VG_(SkipNode_Free)(&sk_segments, s); @@ -700,7 +700,7 @@ VG_(map_file_segment)( Addr addr, SizeT len, s->filename = s->fnIdx==-1 ? NULL : &segnames[s->fnIdx].fname[0]; s->dev = dev; s->ino = ino; - s->symtab = NULL; + s->seginfo = NULL; /* Clean up right now */ preen_segments(); @@ -710,7 +710,7 @@ VG_(map_file_segment)( Addr addr, SizeT len, Valgrind, is at least readable and seems to contain an object file, then try reading symbols from it. */ - if (s->symtab == NULL + if (s->seginfo == NULL && (addr+len < VG_(valgrind_base) || addr > VG_(valgrind_last)) && (flags & (SF_MMAP|SF_NOSYMS)) == SF_MMAP) { if (off == 0 @@ -718,22 +718,22 @@ VG_(map_file_segment)( Addr addr, SizeT len, && (prot & (VKI_PROT_READ|VKI_PROT_EXEC)) == (VKI_PROT_READ|VKI_PROT_EXEC) && len >= VKI_PAGE_SIZE && VG_(is_object_file)((void *)addr)) { - s->symtab = VG_(read_seg_symbols)(s); - if (s->symtab != NULL) { + s->seginfo = VG_(read_seg_symbols)(s); + if (s->seginfo != NULL) { s->flags |= SF_DYNLIB; } } else if (flags & SF_MMAP) { #if 0 const SegInfo *info; - /* Otherwise see if an existing symtab applies to this Segment */ + /* Otherwise see if an existing SegInfo applies to this Segment */ for(info = VG_(next_seginfo)(NULL); info != NULL; info = VG_(next_seginfo)(info)) { if (VG_(seg_overlaps)(s, VG_(seg_start)(info), VG_(seg_size)(info))) { - s->symtab = (SegInfo *)info; - VG_(symtab_incref)((SegInfo *)info); + s->seginfo = (SegInfo *)info; + VG_(seginfo_incref)((SegInfo *)info); } } #endif diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h index 1c01eceb59..dd96193642 100644 --- a/coregrind/pub_core_aspacemgr.h +++ b/coregrind/pub_core_aspacemgr.h @@ -77,7 +77,7 @@ struct _Segment { UInt dev; // device UInt ino; // inode - SegInfo* symtab; // symbol table + SegInfo* seginfo; // symbol table, etc }; /* segment mapped from a file descriptor */ diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c index 45d7bb42e0..233a648636 100644 --- a/coregrind/vg_symtab2.c +++ b/coregrind/vg_symtab2.c @@ -1539,7 +1539,7 @@ Bool read_lib_symbols ( SegInfo* si ) continue; if (seg->symtab != NULL) - VG_(symtab_decref)(seg->symtab, seg->addr); + VG_(seginfo_decref)(seg->symtab, seg->addr); VG_(symtab_incref)(si); seg->symtab = si; @@ -1644,11 +1644,11 @@ Bool read_lib_symbols ( SegInfo* si ) else FIND(".plt", si->plt_start, si->plt_size, dummy_addr, 1, Addr) # undef FIND - - /* Check some sizes */ - vg_assert((o_dynsym_sz % sizeof(ElfXX_Sym)) == 0); - vg_assert((o_symtab_sz % sizeof(ElfXX_Sym)) == 0); } + + /* Check some sizes */ + vg_assert((o_dynsym_sz % sizeof(ElfXX_Sym)) == 0); + vg_assert((o_symtab_sz % sizeof(ElfXX_Sym)) == 0); read_symtab(si, "symbol table", False, o_symtab, o_symtab_sz, @@ -1702,10 +1702,6 @@ Bool read_lib_symbols ( SegInfo* si ) else FIND(".line", dwarf1l, dwarf1l_sz, UChar*) # undef FIND - - /* Check some sizes */ - vg_assert((o_dynsym_sz % sizeof(ElfXX_Sym)) == 0); - vg_assert((o_symtab_sz % sizeof(ElfXX_Sym)) == 0); } } } @@ -1766,7 +1762,7 @@ SegInfo *VG_(read_seg_symbols) ( Segment *seg ) { SegInfo* si; - vg_assert(seg->symtab == NULL); + vg_assert(seg->seginfo == NULL); VGP_PUSHCC(VgpReadSyms); @@ -1869,14 +1865,14 @@ static void unload_symbols ( Addr start, SizeT length ) return; } -void VG_(symtab_decref)(SegInfo *si, Addr start) +void VG_(seginfo_decref)(SegInfo *si, Addr start) { vg_assert(si->ref >= 1); if (--si->ref == 0) unload_symbols(si->start, si->size); } -void VG_(symtab_incref)(SegInfo *si) +void VG_(seginfo_incref)(SegInfo *si) { vg_assert(si->ref > 0); si->ref++; @@ -1949,10 +1945,10 @@ static void search_all_symtabs ( Addr ptr, /*OUT*/SegInfo** psi, s = VG_(find_segment)(ptr); - if (s == NULL || s->symtab == NULL) + if (s == NULL || s->seginfo == NULL) goto not_found; - si = s->symtab; + si = s->seginfo; sno = search_one_symtab ( si, ptr, match_anywhere_in_fun ); if (sno == -1) goto not_found; @@ -2522,56 +2518,56 @@ Bool VG_(use_CFI_info) ( /*MOD*/Addr* ipP, /*--- SegInfo accessor functions ---*/ /*------------------------------------------------------------*/ -const SegInfo* VG_(next_seginfo)(const SegInfo* seg) +const SegInfo* VG_(next_seginfo)(const SegInfo* si) { - if (seg == NULL) + if (si == NULL) return segInfo; - return seg->next; + return si->next; } -Addr VG_(seg_start)(const SegInfo* seg) +Addr VG_(seg_start)(const SegInfo* si) { - return seg->start; + return si->start; } -SizeT VG_(seg_size)(const SegInfo* seg) +SizeT VG_(seg_size)(const SegInfo* si) { - return seg->size; + return si->size; } -const UChar* VG_(seg_filename)(const SegInfo* seg) +const UChar* VG_(seg_filename)(const SegInfo* si) { - return seg->filename; + return si->filename; } -ULong VG_(seg_sym_offset)(const SegInfo* seg) +ULong VG_(seg_sym_offset)(const SegInfo* si) { - return seg->offset; + return si->offset; } VgSectKind VG_(seg_sect_kind)(Addr a) { - SegInfo* seg; + SegInfo* si; VgSectKind ret = Vg_SectUnknown; - for(seg = segInfo; seg != NULL; seg = seg->next) { - if (a >= seg->start && a < (seg->start + seg->size)) { + for(si = segInfo; si != NULL; si = si->next) { + if (a >= si->start && a < (si->start + si->size)) { if (0) - VG_(printf)("addr=%p seg=%p %s got=%p %d plt=%p %d data=%p %d bss=%p %d\n", - a, seg, seg->filename, - seg->got_start, seg->got_size, - seg->plt_start, seg->plt_size, - seg->data_start, seg->data_size, - seg->bss_start, seg->bss_size); + VG_(printf)("addr=%p si=%p %s got=%p %d plt=%p %d data=%p %d bss=%p %d\n", + a, si, si->filename, + si->got_start, si->got_size, + si->plt_start, si->plt_size, + si->data_start, si->data_size, + si->bss_start, si->bss_size); ret = Vg_SectText; - if (a >= seg->data_start && a < (seg->data_start + seg->data_size)) + if (a >= si->data_start && a < (si->data_start + si->data_size)) ret = Vg_SectData; - else if (a >= seg->bss_start && a < (seg->bss_start + seg->bss_size)) + else if (a >= si->bss_start && a < (si->bss_start + si->bss_size)) ret = Vg_SectBSS; - else if (a >= seg->plt_start && a < (seg->plt_start + seg->plt_size)) + else if (a >= si->plt_start && a < (si->plt_start + si->plt_size)) ret = Vg_SectPLT; - else if (a >= seg->got_start && a < (seg->got_start + seg->got_size)) + else if (a >= si->got_start && a < (si->got_start + si->got_size)) ret = Vg_SectGOT; } } diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 4a028b8788..67caa2e7fd 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -2402,14 +2402,15 @@ static void describe_addr ( Addr a, AddrInfo* ai ) /* Search for it in segments */ { - const SegInfo *seg; - - for(seg = VG_(next_seginfo)(NULL); - seg != NULL; - seg = VG_(next_seginfo)(seg)) { - Addr base = VG_(seg_start)(seg); - SizeT size = VG_(seg_size)(seg); - const UChar *filename = VG_(seg_filename)(seg); + const SegInfo *si; + + for (si = VG_(next_seginfo)(NULL); + si != NULL; + si = VG_(next_seginfo)(si)) + { + Addr base = VG_(seg_start)(si); + SizeT size = VG_(seg_size)(si); + const UChar *filename = VG_(seg_filename)(si); if (a >= base && a < base+size) { ai->akind = Segment; diff --git a/include/tool.h b/include/tool.h index 93501e3ef6..98afc8d177 100644 --- a/include/tool.h +++ b/include/tool.h @@ -559,11 +559,11 @@ typedef struct _SegInfo SegInfo; is present or not. */ extern SegInfo* VG_(get_obj) ( Addr a ); -extern const SegInfo* VG_(next_seginfo) ( const SegInfo *seg ); -extern Addr VG_(seg_start) ( const SegInfo *seg ); -extern SizeT VG_(seg_size) ( const SegInfo *seg ); -extern const UChar* VG_(seg_filename) ( const SegInfo *seg ); -extern ULong VG_(seg_sym_offset)( const SegInfo *seg ); +extern const SegInfo* VG_(next_seginfo) ( const SegInfo *si ); +extern Addr VG_(seg_start) ( const SegInfo *si ); +extern SizeT VG_(seg_size) ( const SegInfo *si ); +extern const UChar* VG_(seg_filename) ( const SegInfo *si ); +extern ULong VG_(seg_sym_offset)( const SegInfo *si ); typedef enum {