This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Avoid decode_objc clobbering current language


This fixes the failure in gdb.ada/frame_args.exp:

(gdb) break break_me
Breakpoint 1 at 0x10001170: file /cvs/gdb/gdb/testsuite/gdb.ada/frame_args/pck.adb, line 21.
(gdb) run 
Starting program: /sykes/cvs/test/ppc/gdb/gdb/testsuite/gdb.ada/frame_args/foo 
Error in re-setting breakpoint 1: Function "break_me" not defined.

Program exited normally.
(gdb) FAIL: gdb.ada/frame_args.exp: running to break_me in runto

The problem is that sal_decode_line_1 (here called from
breakpoint_re_set_one) calls decode_objc, which indirectly calls
get_selected_frame.  Since the program is just being started there is no
selected frame yet, thus get_selected_frame called select_frame, which
re-sets current_language (typically to language_c).  Thus the
set_language call in breakpoint_re_set_one is useless.

Andreas.

2008-05-21  Andreas Schwab  <schwab@suse.de>

	* linespec.c (decode_objc): Save current language around call to
	get_selected_block.

--- gdb/linespec.c.~1.79.~	2008-05-20 10:58:04.000000000 +0200
+++ gdb/linespec.c	2008-05-21 18:17:04.000000000 +0200
@@ -1116,8 +1116,16 @@ decode_objc (char **argptr, int funfirst
   if (file_symtab != NULL)
     block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (file_symtab), STATIC_BLOCK);
   else
-    block = get_selected_block (0);
-    
+    {
+      enum language save_language;
+
+      /* get_selected_block can change the current language when there is
+	 no selected frame yet.  */
+      save_language = current_language->la_language;
+      block = get_selected_block (0);
+      set_language (save_language);
+    }
+
   copy = find_imps (file_symtab, block, *argptr, NULL, &i1, &i2); 
     
   if (i1 > 0)

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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