From: Julian Seward Date: Wed, 28 Sep 2005 01:23:25 +0000 (+0000) Subject: Clean up the m_debuginfo interface a bit. X-Git-Tag: svn/VALGRIND_3_1_0~427 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f75575351e97e68c53e0da1453996dcc3514cd1b;p=thirdparty%2Fvalgrind.git Clean up the m_debuginfo interface a bit. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4801 --- diff --git a/coregrind/m_debuginfo/symtab.c b/coregrind/m_debuginfo/symtab.c index 8b404b08a5..281418af5c 100644 --- a/coregrind/m_debuginfo/symtab.c +++ b/coregrind/m_debuginfo/symtab.c @@ -95,6 +95,14 @@ static SegInfo* segInfo_list = NULL; #endif +/*------------------------------------------------------------*/ +/*--- Forwards decls ---*/ +/*------------------------------------------------------------*/ + +static Bool is_elf_object_file ( const void *buf ); +static void unload_symbols ( Addr start, SizeT length ); + + /*------------------------------------------------------------*/ /*--- TOP LEVEL ---*/ /*------------------------------------------------------------*/ @@ -127,11 +135,6 @@ static Bool is_self ( HChar* filename ) return VG_(strstr)( filename, "/lib/valgrind/" ) != NULL; } -//////////// - -// fwds -static void unload_symbols ( Addr start, SizeT length ); - static void nuke_syms_in_range ( Addr start, SizeT length ) { /* Repeatedly scan the segInfo list, looking for segInfos in this @@ -183,7 +186,7 @@ void VG_(di_notify_mmap)( Addr a ) && seg->hasR && seg->hasX && !seg->hasW - && VG_(is_object_file)( (const void*)seg->start ); + && is_elf_object_file( (const void*)seg->start ); if (!ok) { VG_(arena_free)(VG_AR_SYMTAB, filename); @@ -1056,7 +1059,7 @@ void canonicaliseCfiSI ( SegInfo* si ) /*--- Read info from a .so/exe file. ---*/ /*------------------------------------------------------------*/ -Bool VG_(is_object_file)(const void *buf) +static Bool is_elf_object_file(const void *buf) { { ElfXX_Ehdr *ehdr = (ElfXX_Ehdr *)buf; @@ -1437,7 +1440,7 @@ Bool read_lib_symbols ( SegInfo* si ) ehdr = (ElfXX_Ehdr*)oimage; if (ok) - ok &= VG_(is_object_file)(ehdr); + ok &= is_elf_object_file(ehdr); if (!ok) { ML_(symerr)("Invalid ELF header, or missing stringtab/sectiontab."); @@ -1681,7 +1684,7 @@ Bool read_lib_symbols ( SegInfo* si ) if ((dimage = find_debug_file(si->filename, debuglink, crc, &n_dimage)) != 0) { ehdr = (ElfXX_Ehdr*)dimage; - if (n_dimage >= sizeof(ElfXX_Ehdr) && VG_(is_object_file)(ehdr)) + if (n_dimage >= sizeof(ElfXX_Ehdr) && is_elf_object_file(ehdr)) { shdr = (ElfXX_Shdr*)(dimage + ehdr->e_shoff); sh_strtab = (UChar*)(dimage + shdr[ehdr->e_shstrndx].sh_offset); @@ -1853,20 +1856,20 @@ static void unload_symbols ( Addr start, SizeT length ) VGP_POPCC(VgpReadSyms); } -void VG_(seginfo_decref)(SegInfo *si, Addr start) -{ - vg_assert(si); - vg_assert(si->ref >= 1); - if (--si->ref == 0) - unload_symbols(si->start, si->size); -} - -void VG_(seginfo_incref)(SegInfo *si) -{ - vg_assert(si); - vg_assert(si->ref > 0); - si->ref++; -} +//static void seginfo_decref(SegInfo *si, Addr start) +//{ +// vg_assert(si); +// vg_assert(si->ref >= 1); +// if (--si->ref == 0) +// unload_symbols(si->start, si->size); +//} +// +//static void seginfo_incref(SegInfo *si) +//{ +// vg_assert(si); +// vg_assert(si->ref > 0); +// si->ref++; +//} /*------------------------------------------------------------*/ /*--- Use of symbol table & location info to create ---*/ diff --git a/coregrind/pub_core_debuginfo.h b/coregrind/pub_core_debuginfo.h index 7034566c0c..94a76ea7af 100644 --- a/coregrind/pub_core_debuginfo.h +++ b/coregrind/pub_core_debuginfo.h @@ -45,11 +45,8 @@ extern void VG_(di_notify_mmap)( Addr a ); extern void VG_(di_notify_munmap)( Addr a, SizeT len ); extern void VG_(di_notify_mprotect)( Addr a, SizeT len, UInt prot ); -extern Bool VG_(is_object_file) ( const void *hdr ); extern SegInfo *VG_(read_seg_symbols) ( Addr addr, SizeT len, OffT offset, const Char* filename); -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 );