From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19304 invoked by alias); 25 Oct 2012 11:10:29 -0000 Received: (qmail 19288 invoked by uid 22791); 25 Oct 2012 11:10:27 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_EG X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Oct 2012 11:10:21 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TRLKO-0001ks-86 from Ali_Anwar@mentor.com for gdb-patches@sourceware.org; Thu, 25 Oct 2012 04:10:20 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 25 Oct 2012 04:10:20 -0700 Received: from [137.202.157.121] (147.34.91.1) by SVR-ORW-FEM-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server (TLS) id 14.1.289.1; Thu, 25 Oct 2012 04:09:53 -0700 Message-ID: <50891E05.7050509@codesourcery.com> Date: Thu, 25 Oct 2012 11:10:00 -0000 From: ali_anwar User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.28) Gecko/20120313 Thunderbird/3.1.20 MIME-Version: 1.0 To: Subject: Patch to propagate GDB's knowledge of the executing state to frontend Content-Type: multipart/mixed; boundary="------------000402060806070806020108" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-10/txt/msg00492.txt.bz2 --------------000402060806070806020108 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1061 Hi, Attached patch is to let GDB propagate the target state under following two scenarios: 1. Attached patch will enable GDB to inform about the state of the target when it was not able to fetch the non-general registers, when target is already stopped. The reason behind this behavior was an error message which was caused when the GDB was not able to fetch the value of a certain register. The GDB should have told the front end about the current state of the target. The attached patch makes sure that it happens. This patch should be a safety measure in case some debugging stub behaves badly. 2. Attached patch will enable GDB to inform about the state of the target when it was not able to fetch the backtrace once the step has already occurred and target is in stopped state. I have tested the patch for powerpc-eabi as well as i686-pc-linux. No regression was introduced by the patch and results were identical with and without the patch. The patch has also been tested with both sync and async mode, no regression. OK? Thanks, -Ali --------------000402060806070806020108 Content-Type: text/x-patch; name="target_state.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="target_state.patch" Content-length: 2474 Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.14760 diff -u -r1.14760 ChangeLog --- ChangeLog 24 Oct 2012 19:08:15 -0000 1.14760 +++ ChangeLog 25 Oct 2012 10:52:02 -0000 @@ -1,3 +1,13 @@ +2012-10-25 Ali Anwar + + * infrun.c (handle_inferior_event_stub, regcache_dup_stub): + New functions. + (normal_stop): Change to propagate GDB's knowledge of the + executing state to frontend when not able to fetch registers. + (wait_for_inferior): Chnage to propagate GDB's knowledge of + the executing state if not able to fetch backtrace once the + step has already occured. + 2012-10-24 Tristan Gingold * ravenscar-sparc-thread.c (ravenscar_sparc_fetch_registers): Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.559 diff -u -r1.559 infrun.c --- infrun.c 17 Sep 2012 07:26:55 -0000 1.559 +++ infrun.c 25 Oct 2012 10:52:04 -0000 @@ -73,6 +73,10 @@ static int hook_stop_stub (void *); +static int regcache_dup_stub (void *); + +static int handle_inferior_event_stub (void *); + static int restore_selected_frame (void *); static int follow_fork (void); @@ -2701,7 +2705,8 @@ old_chain = make_cleanup (finish_thread_state_cleanup, &minus_one_ptid); /* Now figure out what to do with the result of the result. */ - handle_inferior_event (ecs); + catch_errors (handle_inferior_event_stub, ecs, + "Error while handling inferior event:\n", RETURN_MASK_ALL); /* No error, don't finish the state yet. */ discard_cleanups (old_chain); @@ -6082,7 +6087,8 @@ /* NB: The copy goes through to the target picking up the value of all the registers. */ - stop_registers = regcache_dup (get_current_regcache ()); + catch_errors (regcache_dup_stub, NULL, + "Error while running regcache_dup:\n", RETURN_MASK_ALL); } if (stop_stack_dummy == STOP_STACK_DUMMY) @@ -6154,6 +6160,20 @@ } static int +handle_inferior_event_stub (void *ecs) +{ + handle_inferior_event (ecs); + return (0); +} + +static int +regcache_dup_stub (void *arg) +{ + stop_registers = regcache_dup (get_current_regcache ()); + return (0); +} + +static int hook_stop_stub (void *cmd) { execute_cmd_pre_hook ((struct cmd_list_element *) cmd); --------------000402060806070806020108--