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]

Re: Side-effects of double-parsing patch


"Paul N. Hilfinger" wrote:
> 
> Now here's my question: symbol_file_command eventually calls
> symbol_file_add, too, but it then goes on to call RESET_HP_UX_GLOBALS,
> reinit_cache_frame, and set_initial_language.  This no longer happens
> for the "internal" calls.  One side effect is that set_initial_language is
> not called when GDB starts up, so that one now always starts in C (I think).
> Unfortunately, this turns out to be a slight problem in the changes I am
> making for Ada.  This could be just a peculiarity of Ada, of course, so before
> I do anything kludgey, may I ask what the reasoning was behind dispensing with
> these three calls?

I looked again at the logic in there and I am inclined to believe it was
a mistake.  

I tend to dislike side-effects and probably wanted symbol_file_add() to
do only what the name implies and let the upper layers do whatever
actions they think are appropriate to be done concomitantly. But in this
case the reset of the frame cache and the setting of the language are
almost "part" of the action of loading a symbol file.

The attached patch moves the operations you've mentioned to the
"internal" libgdb call.  I have just run the testsuite (I have no time
to test it any further today).  You can help by trying it and let us
know if it solves your problem.

Thanks for reporting this.

Regards,
Fernando




-- 
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/04/29 16:13:12
*************** symbol_file_add (char *name, int from_tt
*** 893,898 ****
--- 893,907 ----
    if (target_new_objfile_hook)
      target_new_objfile_hook (objfile);
  
+ #ifdef HPUXHPPA
+   RESET_HP_UX_GLOBALS ();
+ #endif
+   /* Getting new symbols may change our opinion about
+      what is frameless.  */
+   reinit_frame_cache ();
+ 
+   set_initial_language ();
+ 
    return (objfile);
  }
  
*************** 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++;
  	}
--- 989,994 ----

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