From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32679 invoked by alias); 11 Jan 2008 22:05:01 -0000 Received: (qmail 32670 invoked by uid 22791); 11 Jan 2008 22:05:00 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 11 Jan 2008 22:04:35 +0000 Received: from kahikatea.snap.net.nz (157.60.255.123.dynamic.snap.net.nz [123.255.60.157]) by viper.snap.net.nz (Postfix) with ESMTP id D0CB43DA1F8; Sat, 12 Jan 2008 11:04:32 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id EF13E8FC6D; Sat, 12 Jan 2008 11:04:27 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18311.59371.644989.985603@kahikatea.snap.net.nz> Date: Fri, 11 Jan 2008 22:05:00 -0000 To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: MI/CLI breakpoint handling code duplication X-Mailer: VM 7.19 under Emacs 23.0.50.27 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: 2008-01/txt/msg00294.txt.bz2 [2nd attempt] (Fri, 14 Dec 2007 10:26:49 +0400) > > * breakpoint.c (break_command_really): New, copied > > from break_command_1. New parameters COND_STRING, THREAD > > PARSE_CONDITITION_AND_THREAD and PENDING_BREAK_SUPPORT. > > The previous FLAG parameter split into TEMPFLAG and > > HARDWAREFLAG. > > When PARSE_CONDITION_AND_THREAD is not set, duplicate > > the passed condition string. > > (struct captured_breakpoint_args): Remove > > (do_captured_breakpoint): Remove. > > (break_command_1): Relay to break_command_really. > > (gdb_breakpoint): Relay to break_command_really. > Ping? This patch is pure refactoring which is basis for > the 'pending breakpoint in MI' patch. Given that the patch > is not supposed to change any behaviour and causes no regression, > I'd hope it should be easy to review :-) Previously: (gdb) -break-insert sqrt &"Function \"sqrt\" not defined.\n" ^error,msg="Function \"sqrt\" not defined." (gdb) After this change: (gdb) -break-insert sqrt &"Function \"sqrt\" not defined.\n" ^error,msg="unknown error" (gdb) So this is *not* pure refactoring and happens because gdb_breakpoint used catch_exceptions_with_msg previously while it now uses catch_exception through break_command_really. This means now that in mi_cmd_break_insert rc = gdb_breakpoint (address, condition, 0 /*hardwareflag */ , temp_p, thread, ignore_count, pending, &mi_error_message); mi_error_message points to NULL. Furthermore with a sequence like: (gdb) -break-insert main ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x080485bc",func="main",file="/home/nickrob/myprog.c",fullname="/home/nickrob/myprog.c",line="79",times="0"} (gdb) -break-insert sqrt &"Function \"sqrt\" not defined.\n" ^error,msg="unknown error" (gdb) -exec-run ^running (gdb) *stopped,bkpt={number="-1",type="longjmp resume",disp="keep",enabled="n",addr="0x00000000",at="",times="0"},bkpt={number="-2",type="longjmp resume",disp="keep",enabled="n",addr="0x00000000",at="",times="0"},bkpt={number="-4",type="longjmp resume",disp="keep",enabled="n",addr="0x00000000",at="",times="0"},bkpt={number="-5",type="longjmp resume",disp="keep",enabled="n",addr="0x00000000",at="",times="0"},reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x080485bc",func="main",args=[{name="argc",value="-1074490904"},{name="argv",value="0xbff49214"}],file="/home/nickrob/myprog.c",fullname="/home/nickrob/myprog.c",line="79"} (gdb) GDB prints extra output because previous content has not been flushed from the stream. I think this is because gdb_breakpoint tries to return int (really enum REASON, -2 or -1) through break_command_really while it is type enum gdb_rc (0, 1 or 2). So that when gdb_breakpoint fails (and returns RETURN_ERROR = -1) mi_cmd_break_insert thinks it has suceeded and returns MI_CMD_DONE (GDB_RC_FAIL = 0): if (rc == GDB_RC_FAIL) return MI_CMD_ERROR; else return MI_CMD_DONE; I still don't understand the difference between breakpoint handling in MI and CLI but it must surely have been done differently for a reason. -- Nick http://www.inet.net.nz/~nickrob "Theories should be as simple as possible, but no simpler." Albert Einstein