From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30931 invoked by alias); 10 Mar 2008 18:50:18 -0000 Received: (qmail 30922 invoked by uid 22791); 10 Mar 2008 18:50:17 -0000 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO qnxmail.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 10 Mar 2008 18:49:59 +0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.42.96.5]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id OAA15862; Mon, 10 Mar 2008 14:31:27 -0400 Received: from [10.42.100.129] (dhcp-100-129 [10.42.100.129]) by smtp.ott.qnx.com (8.8.8/8.6.12) with ESMTP id NAA31221; Mon, 10 Mar 2008 13:49:52 -0500 Message-ID: <47D582CF.4060003@qnx.com> Date: Mon, 10 Mar 2008 18:50:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Vladimir Prus CC: gdb-patches@sources.redhat.com, nickrob@snap.net.nz Subject: Re: [patch] fix for PR2424 References: <47CED9FB.7090904@qnx.com> <200803101745.16451.vladimir@codesourcery.com> <47D56D4E.5040902@qnx.com> <200803102036.05829.vladimir@codesourcery.com> In-Reply-To: <200803102036.05829.vladimir@codesourcery.com> Content-Type: multipart/mixed; boundary="------------010809040302000508080003" 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-03/txt/msg00105.txt.bz2 This is a multi-part message in MIME format. --------------010809040302000508080003 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2219 Vladimir Prus wrote: > On Monday 10 March 2008 20:18:06 Aleksandar Ristovski wrote: >> Vladimir Prus wrote: >> The proposed patch (attached) will produce the following outputs: >> >> CLI: >> (gdb) tbreak main >> Temporary breakpoint 1 at 0x80483a0: file ./main.c, line 15. >> (gdb) r >> Starting program: /space/src/testcases/sigsegv/main >> >> Temporary breakpoint 1, main () at ./main.c:15 >> 15 foo (p); >> >> MI: >> (gdb) >> -break-insert -t main >> ^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x080483a0",func="main",file="./main.c",fullname="/space/src/testcases/sigsegv/main.c",line="15",times="0"} >> (gdb) >> -exec-run >> ^running >> (gdb) >> *stopped,reason="breakpoint-hit",disp="del",bkptno="1",thread-id="0",frame={addr="0x080483a0",func="main",args=[],file="./main.c",fullname="/space/src/testcases/sigsegv/main.c",line="15"} >> > > For consistency, it's better to use same printing of 'disp' as done > in print_one_breakpoint_location: > > ui_out_field_string (uiout, "disp", bpdisps[(int) b->disposition]); > > bpdisps is actually a table local to print_one_breakpoint_location, > but there's no reason why it cannot be made a global table. > > - Volodya > New diff for code (testsuite remains the same as in previous email). Static array bpstats moved to new function bpstat_text and function used. Note: I believe docs need also be changed since in the examples for mi protocol there are no 'disp' fields. But I am not sure where do I need to make those changes. 2008-03-10 Aleksandar Ristovski * infrun.c (normal_stop) Move breakpoint_auto_delete further down to allow printing to 'see' real reason of stop. This fixes PR 2424. * breakpoint.c (bpdisp_texst): New function. The function takes over the role of bpstats static array in print_one_breakpoint_location. (print_it_typical): Print "Temporary breakpoint" instead of just "Breakpoint" when breakpoint is, well, temporary. For mi-like protocols, print disp field. (print_one_breakpoint_location): Removed bpdisps static definition. Call new bpstat_text function to get value for 'disp' field. (mention): Print "Temporary breakpoint" instead of just "Breakpoint". --------------010809040302000508080003 Content-Type: text/plain; name="PR2424.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="PR2424.diff" Content-length: 4247 Index: gdb/infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.266 diff -u -p -r1.266 infrun.c --- gdb/infrun.c 29 Jan 2008 22:47:19 -0000 1.266 +++ gdb/infrun.c 10 Mar 2008 18:40:15 -0000 @@ -3151,11 +3151,6 @@ Further execution is probably impossible } } - /* Delete the breakpoint we stopped at, if it wants to be deleted. - Delete any breakpoint that is to be deleted at the next stop. */ - - breakpoint_auto_delete (stop_bpstat); - /* If an auto-display called a function and that got a signal, delete that auto-display to avoid an infinite recursion. */ @@ -3294,6 +3289,9 @@ Further execution is probably impossible done: annotate_stopped (); observer_notify_normal_stop (stop_bpstat); + /* Delete the breakpoint we stopped at, if it wants to be deleted. + Delete any breakpoint that is to be deleted at the next stop. */ + breakpoint_auto_delete (stop_bpstat); } static int Index: gdb/breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.304 diff -u -p -r1.304 breakpoint.c --- gdb/breakpoint.c 27 Feb 2008 20:27:49 -0000 1.304 +++ gdb/breakpoint.c 10 Mar 2008 18:40:17 -0000 @@ -210,8 +210,16 @@ unlink_locations_from_global_list (struc static int is_hardware_watchpoint (struct breakpoint *bpt); -/* Prototypes for exported functions. */ +static const char * +bpdisp_text (enum bpdisp disp) +{ + /* NOTE: the following values are a part of MI protocol and represent + values of 'disp' field returned when inferior stops at a breakpoint. */ + static char *bpdisps[] = {"del", "dstp", "dis", "keep"}; + return bpdisps[(int) disp]; +} +/* Prototypes for exported functions. */ /* If FALSE, gdb will not use hardware support for watchpoints, even if such is available. */ static int can_use_hw_watchpoints; @@ -2131,6 +2139,7 @@ print_it_typical (bpstat bs) struct breakpoint *b; const struct bp_location *bl; struct ui_stream *stb; + int bp_temp = 0; stb = ui_out_stream_new (uiout); old_chain = make_cleanup_ui_out_stream_delete (stb); /* bs->breakpoint_at can be NULL if it was a momentary breakpoint @@ -2144,15 +2153,22 @@ print_it_typical (bpstat bs) { case bp_breakpoint: case bp_hardware_breakpoint: + bp_temp = bs->breakpoint_at->owner->disposition == disp_del; if (bl->address != bl->requested_address) breakpoint_adjustment_warning (bl->requested_address, bl->address, b->number, 1); annotate_breakpoint (b->number); - ui_out_text (uiout, "\nBreakpoint "); + if (bp_temp) + ui_out_text (uiout, "\nTemporary breakpoint "); + else + ui_out_text (uiout, "\nBreakpoint "); if (ui_out_is_mi_like_p (uiout)) - ui_out_field_string (uiout, "reason", - async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT)); + { + ui_out_field_string (uiout, "reason", + async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT)); + ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition)); + } ui_out_field_int (uiout, "bkptno", b->number); ui_out_text (uiout, ", "); return PRINT_SRC_AND_LOC; @@ -3362,8 +3378,6 @@ print_one_breakpoint_location (struct br {bp_catch_exec, "catch exec"} }; - static char *bpdisps[] = - {"del", "dstp", "dis", "keep"}; static char bpenables[] = "nynny"; char wrap_indent[80]; struct ui_stream *stb = ui_out_stream_new (uiout); @@ -3420,7 +3434,7 @@ print_one_breakpoint_location (struct br if (part_of_multiple) ui_out_field_skip (uiout, "disp"); else - ui_out_field_string (uiout, "disp", bpdisps[(int) b->disposition]); + ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition)); /* 4 */ @@ -4792,7 +4806,11 @@ mention (struct breakpoint *b) say_where = 0; break; } - printf_filtered (_("Breakpoint %d"), b->number); + if (b->disposition == disp_del) + printf_filtered (_("Temporary breakpoint")); + else + printf_filtered (_("Breakpoint")); + printf_filtered (_(" %d"), b->number); say_where = 1; break; case bp_hardware_breakpoint: --------------010809040302000508080003--