This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, gdb6.8] -break-list doesn't list multiple breakpoints


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);
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]