From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8029 invoked by alias); 4 Dec 2008 20:19:17 -0000 Received: (qmail 8018 invoked by uid 22791); 4 Dec 2008 20:19:16 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Dec 2008 20:18:41 +0000 Received: from wpaz5.hot.corp.google.com (wpaz5.hot.corp.google.com [172.24.198.69]) by smtp-out.google.com with ESMTP id mB4KId82014940 for ; Thu, 4 Dec 2008 12:18:39 -0800 Received: from localhost (ruffy.corp.google.com [172.18.118.116]) by wpaz5.hot.corp.google.com with ESMTP id mB4KIb6I030986 for ; Thu, 4 Dec 2008 12:18:38 -0800 Received: by localhost (Postfix, from userid 67641) id 29DF91C7A10; Thu, 4 Dec 2008 12:18:37 -0800 (PST) To: gdb@sourceware.org Subject: call_function_by_hand doesn't restore target async? Message-Id: <20081204201837.29DF91C7A10@localhost> Date: Thu, 04 Dec 2008 20:19:00 -0000 From: dje@google.com (Doug Evans) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-12/txt/msg00007.txt.bz2 Hi. Should there be a cleanup to restore target_async_mask? call_function_by_hand has this: { struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0); struct cleanup *old_cleanups2; int saved_async = 0; struct thread_info *tp = inferior_thread (); /* Save this thread's ptid, we need it later but the thread may have exited. */ this_thread_ptid = tp->ptid; /* If all error()s out of proceed ended up calling normal_stop (and perhaps they should; it already does in the special case of error out of resume()), then we wouldn't need this. */ make_cleanup (breakpoint_auto_delete_contents, NULL); disable_watchpoints_before_interactive_call_start (); tp->proceed_to_finish = 1; /* We want stop_registers, please... */ if (target_can_async_p ()) saved_async = target_async_mask (0); old_cleanups2 = make_cleanup_restore_integer (&suppress_resume_observer); suppress_resume_observer = 1; make_cleanup_restore_integer (&suppress_stop_observer); suppress_stop_observer = 1; proceed (real_pc, TARGET_SIGNAL_0, 0); do_cleanups (old_cleanups2); if (saved_async) target_async_mask (saved_async); enable_watchpoints_after_interactive_call_stop (); discard_cleanups (old_cleanups); } target.h has this: /* This is to be used ONLY within call_function_by_hand(). It provides a workaround, to have inferior function calls done in sychronous mode, even though the target is asynchronous. After target_async_mask(0) is called, calls to target_can_async_p() will return FALSE , so that target_resume() will not try to start the target asynchronously. After the inferior stops, we IMMEDIATELY restore the previous nature of the target, by calling target_async_mask(1). After that, target_can_async_p() will return TRUE. ANY OTHER USE OF THIS FEATURE IS DEPRECATED. FIXME ezannoni 1999-12-13: we won't need this once we move the turning async on and off to the single execution commands, from where it is done currently, in remote_resume(). */ #define target_async_mask(MASK) \ (current_target.to_async_mask (MASK)) I don't see any other calls to target_async_mask. Given that it's only to be used by call_function_by_hand that's understandable, but then I don't understand how target_async_mask gets restored if proceed errors out. I'll add a fix to my dummy-frames patch if there's a bug here. If there isn't a bug I'll at least add a comment. :-) [and I'll need to start breaking it into a set of smaller patches ...]