]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
A bit of cleaning up now that symbol table reading is no longer optional.
authorJulian Seward <jseward@acm.org>
Thu, 10 Jul 2003 23:31:27 +0000 (23:31 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 10 Jul 2003 23:31:27 +0000 (23:31 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1745

coregrind/vg_include.h
coregrind/vg_main.c
coregrind/vg_memory.c
coregrind/vg_symtab2.c

index db1caf79f17fc09c32638fbd3c24485d62660295..0521471ca6df3845e3cd047b32fdfe15624dcb03 100644 (file)
@@ -1273,11 +1273,11 @@ void VG_(read_procselfmaps) (
    Exports of vg_symtab2.c
    ------------------------------------------------------------------ */
 
-extern void VG_(maybe_read_symbols)   ( void );
+extern void VG_(read_symbols)         ( void );
 extern void VG_(read_symtab_callback) ( Addr start, UInt size, 
                                         Char rr, Char ww, Char xx,
                                         UInt foffset, UChar* filename );
-extern void VG_(maybe_unload_symbols) ( Addr start, UInt length );
+extern void VG_(unload_symbols)       ( Addr start, UInt length );
 
 extern Bool VG_(get_fnname_nodemangle)( Addr a, Char* fnname, Int n_fnname );
 extern void VG_(mini_stack_dump)      ( ExeContext* ec );
index d7d6f4aa51ec4a3a1a31b5d21b9a32aec9e80755..7edbd9748aed49258028ffd02dc5586f84776b52 100644 (file)
@@ -1507,7 +1507,6 @@ void VG_(main) ( void )
 
    /* Force a read of the debug info so that we can look for 
       glibc entry points to intercept. */
-   VG_(maybe_read_symbols)();
    VG_(setup_code_redirect_table)();
 
    /* Now it is safe for malloc et al in vg_clientmalloc.c to act
index 4e89cc5752bcf106768c0af4eb2d37ec5a428cd5..1241d9f727e8820b0a085ac99645c4d91a50b906 100644 (file)
@@ -128,7 +128,7 @@ static Bool remove_if_exe_segment_from_list( Addr a )
 void VG_(new_exe_segment) ( Addr a, UInt len )
 {
    add_exe_segment_to_list( a, len );
-   VG_(maybe_read_symbols)();
+   VG_(read_symbols)();
 }
 
 /* Invalidate translations as necessary (also discarding any basic
@@ -141,7 +141,7 @@ void VG_(remove_if_exe_segment) ( Addr a, UInt len )
 {
    if (remove_if_exe_segment_from_list( a )) {
       VG_(invalidate_translations) ( a, len, False );
-      VG_(maybe_unload_symbols)    ( a, len );
+      VG_(unload_symbols)          ( a, len );
    }
 }
 
index aa34844405451acf068887362764b2a77432b2e7..a79342d56b1e1f6c896a2e6b66ac44e8279c9384 100644 (file)
@@ -40,8 +40,6 @@
    Stabs reader greatly improved by Nick Nethercote, Apr 02.
 */
 
-/* Set to True when first debug info search is performed */
-Bool VG_(using_debug_info) = False;
 
 /*------------------------------------------------------------*/
 /*--- Structs n stuff                                      ---*/
@@ -1913,6 +1911,11 @@ void VG_(read_symtab_callback) (
    si->strtab = NULL;
    si->strtab_size = si->strtab_used = 0;
 
+   si->plt_start  = si->plt_size = 0;
+   si->got_start  = si->got_size = 0;
+   si->data_start = si->data_size = 0;
+   si->bss_start  = si->bss_size = 0;
+
    /* And actually fill it up. */
    if (!vg_read_lib_symbols ( si ) && 0) {
       /* XXX this interacts badly with the prevN optimization in
@@ -1941,16 +1944,11 @@ void VG_(read_symtab_callback) (
    libraries as they are dlopen'd.  Conversely, when the client does
    munmap(), vg_symtab_notify_munmap() throws away any symbol tables
    which happen to correspond to the munmap()d area.  */
-void VG_(maybe_read_symbols) ( void )
+void VG_(read_symbols) ( void )
 {
    /* 9 July 2003: In order to work around PLT bypassing in
       glibc-2.3.2 (see below VG_(setup_code_redirect_table)), we need
-      to load debug info regardless of the skin, unfortunately.  Hence
-      .. */
-
-   /* if (!VG_(using_debug_info))
-         return;
-   */
+      to load debug info regardless of the skin, unfortunately.  */
 
    VGP_PUSHCC(VgpReadSyms);
       VG_(read_procselfmaps) ( VG_(read_symtab_callback),
@@ -1964,13 +1962,10 @@ void VG_(maybe_read_symbols) ( void )
    accuracy of error messages, but we need to do it in order to
    maintain the no-overlapping invariant.
 */
-void VG_(maybe_unload_symbols) ( Addr start, UInt length )
+void VG_(unload_symbols) ( Addr start, UInt length )
 {
    SegInfo *prev, *curr;
 
-   if (!VG_(using_debug_info))
-      return;
-
    prev = NULL;
    curr = segInfo;
    while (True) {
@@ -2004,14 +1999,6 @@ void VG_(maybe_unload_symbols) ( Addr start, UInt length )
 /*--- plausible-looking stack dumps.                       ---*/
 /*------------------------------------------------------------*/
 
-static __inline__ void ensure_debug_info_inited ( void )
-{
-   if (!VG_(using_debug_info)) {
-      VG_(using_debug_info) = True;
-      VG_(maybe_read_symbols)();
-   }
-}
-
 /* Find a symbol-table index containing the specified pointer, or -1
    if not found.  Binary search.  */
 
@@ -2072,7 +2059,6 @@ static void search_all_symtabs ( Addr ptr, /*OUT*/SegInfo** psi,
    Int      sno;
    SegInfo* si;
 
-   ensure_debug_info_inited();
    VGP_PUSHCC(VgpSearchSyms);
    
    for (si = segInfo; si != NULL; si = si->next) {
@@ -2127,7 +2113,6 @@ static void search_all_loctabs ( Addr ptr, /*OUT*/SegInfo** psi,
 
    VGP_PUSHCC(VgpSearchSyms);
 
-   ensure_debug_info_inited();
    for (si = segInfo; si != NULL; si = si->next) {
       if (si->start <= ptr && ptr < si->start+si->size) {
          lno = search_one_loctab ( si, ptr );
@@ -2232,7 +2217,6 @@ Bool VG_(get_objname) ( Addr a, Char* buf, Int nbuf )
 {
    SegInfo* si;
 
-   ensure_debug_info_inited();
    for (si = segInfo; si != NULL; si = si->next) {
       if (si->start <= a && a < si->start+si->size) {
          VG_(strncpy_safely)(buf, si->filename, nbuf);
@@ -2248,7 +2232,6 @@ SegInfo* VG_(get_obj) ( Addr a )
 {
    SegInfo* si;
 
-   ensure_debug_info_inited();
    for (si = segInfo; si != NULL; si = si->next) {
       if (si->start <= a && a < si->start+si->size) {
          return si;
@@ -2404,7 +2387,6 @@ Int VG_(setup_code_redirect_table) ( void )
 
    /* Look for the SegInfo for glibc and our pthread library. */
 
-   ensure_debug_info_inited();
    si_libc = si_pth = NULL;
 
    for (si = segInfo; si != NULL; si = si->next) {
@@ -2453,8 +2435,6 @@ Int VG_(setup_code_redirect_table) ( void )
 
 const SegInfo* VG_(next_seginfo)(const SegInfo* seg)
 {
-   ensure_debug_info_inited();
-
    if (seg == NULL)
       return segInfo;
    return seg->next;
@@ -2485,8 +2465,6 @@ VgSectKind VG_(seg_sect_kind)(Addr a)
    SegInfo* seg;
    VgSectKind ret = Vg_SectUnknown;
 
-   ensure_debug_info_inited();
-
    for(seg = segInfo; seg != NULL; seg = seg->next) {
       if (a >= seg->start && a < (seg->start + seg->size)) {
         if (0)