From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3617 invoked by alias); 2 Apr 2008 14:13:34 -0000 Received: (qmail 3593 invoked by uid 22791); 2 Apr 2008 14:13:32 -0000 X-Spam-Check-By: sourceware.org Received: from smtp6.poczta.onet.pl (HELO smtp6.poczta.onet.pl) (213.180.130.36) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 02 Apr 2008 14:13:03 +0000 Received: from static-62-233-152-148.devs.futuro.pl ([62.233.152.148]:2711 "EHLO [10.0.0.62]" rhost-flags-OK-OK-OK-FAIL) by ps6.test.onet.pl with ESMTPSA id S184557819AbYDBOM7FRFyy (ORCPT ); Wed, 2 Apr 2008 16:12:59 +0200 Message-ID: <47F3946A.3090000@op.pl> Date: Wed, 02 Apr 2008 17:16:00 -0000 From: Bogdan Slusarczyk User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [PATCH, gdb6.8] -break-list doesn't list multiple breakpoints Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit 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-04/txt/msg00040.txt.bz2 Hi everyone, I wrote my own patch for -break-list. I'm not sure that it meets all requirements mentioned in http://sourceware.org/ml/gdb-patches/2008-01/msg00251.html and previous discussions, but combination -break-list + multiple breakpoints is now usable for me. I'm not familiar with gdb test suit, so it's NOT tested at all (except few my own cases). What does it do? Until now -break-list returned: (variable) bkpt (tuple) { (result) (variable) number (c-string) 4 (result) (variable) type (c-string) breakpoint (result) (variable) disp (c-string) keep (result) (variable) enabled (c-string) n (result) (variable) addr (c-string) (result) (variable) addr (c-string) 0x6f14137f (result) (variable) times (c-string) 1 .... After my changes it returns additional list named 'locations' instead of second 'addr' field: (variable) bkpt (tuple) { (result) (variable) number (c-string) 4 (result) (variable) type (c-string) breakpoint (result) (variable) disp (c-string) keep (result) (variable) enabled (c-string) y (result) (variable) addr (c-string) (result) (variable) times (c-string) 1 (result) (variable) locations (list) [ (tuple) { (result) (variable) number (c-string) 4.1 (result) (variable) enabled (c-string) y (result) (variable) addr (c-string) 0x6f14137f (result) (variable) func (c-string) inv::negate() (result) (variable) file (c-string) src/inv.cpp (result) (variable) fullname (c-string) c:/test/src/inv.cpp (result) (variable) line (c-string) 17 (tuple) { (result) (variable) number (c-string) 4.2 (result) (variable) enabled (c-string) y (result) (variable) addr (c-string) 0x0442137f (result) (variable) func (c-string) inv::negate() (result) (variable) file (c-string) src/inv.cpp (result) (variable) fullname (c-string) c:/test/src/inv.cpp (result) (variable) line (c-string) 17 Regards, Bogdan --- breakpoint.c Tue Feb 26 09:14:12 2008 +++ c:/3/gdb-6.8/gdb/breakpoint.c Wed Apr 02 11:45:31 2008 @@ -3385,7 +3385,7 @@ print_one_breakpoint_location (struct br loc = b->loc; annotate_record (); - bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "bkpt"); + bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, !part_of_multiple ? "bkpt" : NULL); /* 1 */ annotate_field (0); @@ -3401,27 +3401,22 @@ print_one_breakpoint_location (struct br ui_out_field_int (uiout, "number", b->number); } - /* 2 */ + /* 2 */ annotate_field (1); - if (part_of_multiple) - ui_out_field_skip (uiout, "type"); - else - { + if (!part_of_multiple) + { if (((int) b->type >= (sizeof (bptypes) / sizeof (bptypes[0]))) || ((int) b->type != bptypes[(int) b->type].type)) internal_error (__FILE__, __LINE__, _("bptypes table does not describe type #%d."), (int) b->type); ui_out_field_string (uiout, "type", bptypes[(int) b->type].description); - } + } /* 3 */ annotate_field (2); - if (part_of_multiple) - ui_out_field_skip (uiout, "disp"); - else - ui_out_field_string (uiout, "disp", bpdisps[(int) b->disposition]); - + if (!part_of_multiple) + ui_out_field_string (uiout, "disp", bpdisps[(int) b->disposition]); /* 4 */ annotate_field (3); @@ -3542,15 +3537,19 @@ print_one_breakpoint_location (struct br { annotate_field (4); if (header_of_multiple) - ui_out_field_string (uiout, "addr", ""); - if (b->loc == NULL || loc->shlib_disabled) - ui_out_field_string (uiout, "addr", ""); - else - ui_out_field_core_addr (uiout, "addr", loc->address); + ui_out_field_string (uiout, "addr", ""); + else + { + if (b->loc == NULL || loc->shlib_disabled) + ui_out_field_string (uiout, "addr", ""); + else + ui_out_field_core_addr (uiout, "addr", loc->address); + } } annotate_field (5); if (!header_of_multiple) print_breakpoint_location (b, loc, wrap_indent, stb); + if (b->loc) *last_addr = b->loc->address; break; @@ -3633,6 +3632,22 @@ print_one_breakpoint_location (struct br print_command_lines (uiout, l, 4); do_cleanups (script_chain); } + + if ( header_of_multiple && ui_out_is_mi_like_p (uiout) ) + { + struct cleanup *locations_chain; + struct bp_location *loc; + int n = 1; + + annotate_field (10); + locations_chain = make_cleanup_ui_out_list_begin_end( uiout, "locations" ); + + for (loc = b->loc; loc; loc = loc->next, n++ ) + print_one_breakpoint_location (b, loc, n, last_addr); + + do_cleanups (locations_chain); + } + do_cleanups (bkpt_chain); do_cleanups (old_chain); }