Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: gdb-patches@sourceware.org
Subject: Avoid decode_objc clobbering current language
Date: Wed, 21 May 2008 19:38:00 -0000	[thread overview]
Message-ID: <je8wy3d2t8.fsf@sykes.suse.de> (raw)

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."


             reply	other threads:[~2008-05-21 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21 19:38 Andreas Schwab [this message]
2008-05-24  8:18 ` Joel Brobecker
2008-05-26 15:48   ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=je8wy3d2t8.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox