Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bogdan Slusarczyk <bodzio131@op.pl>
To: gdb-patches@sourceware.org
Subject: [PATCH, gdb6.8] -break-list doesn't list multiple breakpoints
Date: Wed, 02 Apr 2008 17:16:00 -0000	[thread overview]
Message-ID: <47F3946A.3090000@op.pl> (raw)

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) <MULTIPLE>
   (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) <MULTIPLE>
   (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", "<MULTIPLE>");
-	    if (b->loc == NULL || loc->shlib_disabled)
-	      ui_out_field_string (uiout, "addr", "<PENDING>");
-	    else
-	      ui_out_field_core_addr (uiout, "addr", loc->address);
+			ui_out_field_string (uiout, "addr", "<MULTIPLE>");
+		else
+		{
+			if (b->loc == NULL || loc->shlib_disabled)
+			ui_out_field_string (uiout, "addr", "<PENDING>");
+			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);
  }


             reply	other threads:[~2008-04-02 14:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 17:16 Bogdan Slusarczyk [this message]
2008-04-03  5:42 ` Nick Roberts
2008-04-03  6:44   ` Vladimir Prus
2008-04-03  9:21     ` Nick Roberts
2008-04-03 10:00       ` Vladimir Prus
2008-04-03 10:45         ` Nick Roberts
2008-04-03 10:49           ` Vladimir Prus
2008-04-03 11:28             ` Nick Roberts
2008-04-03 11:39               ` Vladimir Prus
2008-04-03 11:52               ` Bogdan Slusarczyk
2008-04-03 12:12                 ` Vladimir Prus
2008-04-03 12:48                   ` Bogdan Slusarczyk
2008-04-14 18:22 ` Daniel Jacobowitz
2008-04-15  8:35   ` Vladimir Prus
2008-04-15 20:13   ` Bogdan Slusarczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47F3946A.3090000@op.pl \
    --to=bodzio131@op.pl \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox