This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFA: [symfile.c} Fix to symbol_file_add() [REPOST]


After the fruitful discussions with Elena, I believe I have a better
patch, so please consider this one instead.

As Elena explained, we must let the callers of symbol_file_add() do the
cache reset as we may be loading several shared libraries.  Doing the
cache reset for each one is too much overhead as we will have to grab
the data for filling the current frame every single time.  Well,
symbol_file_add_main () is a caller, so I guess it can go there.  And
none of its callers has a a call to reinit_frame_cache() as they used to
call symbol_file_command().

I guess the previous behavior is being safely restored now.

However, several of the callers of symbol_file_add() do not call
reinit_frame_cache() as they should.  But as far as I can tell, this has
always been like that.  The only thing that is lost is the possibility
to get a better frame description of the current stack by using the
newly read symbols.  I don't know enough about all this targets to know
if this is important (I don't know why they are reading symbol files). 
The shared library case is already taken care of as Elena has pointed
out.



ChangeLog:

        * symfile.c (symbol_file_command): Move cleanup operations
        from here...
        (symbol_file_add_main): ...to here, so they are run every time
        a new main symbol file is read.


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.31
diff -c -p -r1.31 symfile.c
*** symfile.c	2001/04/05 02:02:13	1.31
--- symfile.c	2001/05/02 15:35:32
*************** symbol_file_add (char *name, int from_tt
*** 896,908 ****
    return (objfile);
  }
  
! /* Just call the above with default values.
!    Used when the file is supplied in the gdb command line. */
     
  void
  symbol_file_add_main (char *args, int from_tty)
  {
    symbol_file_add (args, from_tty, NULL, 1, 0);
  }
  
  void
--- 896,920 ----
    return (objfile);
  }
  
! /* Call the above with default values and update whatever is
!    affected by a new main().
!    Used when the file is supplied in the gdb command line
!    and by some targets. */
     
  void
  symbol_file_add_main (char *args, int from_tty)
  {
    symbol_file_add (args, from_tty, NULL, 1, 0);
+ 
+ #ifdef HPUXHPPA
+   RESET_HP_UX_GLOBALS ();
+ #endif
+ 
+   /* Getting new symbols may change our opinion about
+      what is frameless.  */
+   reinit_frame_cache ();
+ 
+   set_initial_language ();
  }
  
  void
*************** symbol_file_command (char *args, int fro
*** 980,993 ****
  		{
                    name = *argv;
  		  symbol_file_add (name, from_tty, NULL, 1, flags);
- #ifdef HPUXHPPA
- 		  RESET_HP_UX_GLOBALS ();
- #endif
- 		  /* Getting new symbols may change our opinion about
- 		     what is frameless.  */
- 		  reinit_frame_cache ();
- 
- 		  set_initial_language ();
  		}
  	  argv++;
  	}
--- 992,997 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]