Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* minimalistic MI catch support
@ 2006-01-28 13:04 Markus Schiltknecht
  2006-02-06 23:29 ` Daniel Jacobowitz
  0 siblings, 1 reply; 15+ messages in thread
From: Markus Schiltknecht @ 2006-01-28 13:04 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

Hello gdb hackers,

working on an automated debugging layer on top of gdb I figured the
catchpoint functions in the MI interface is missing. The attached patch
against current CVS at least makes gdb report a catchpoint-break via MI.
This is already sufficient for my application. However, I would
appreciate a complete catchpoint implementation for the MI interface. I
haven't figured out how to implement the '-break-catch' command. If
somebody more knowledgable could do that I'd be thankfull.

Please CC me in responses, as I'm not subscribed.

Regards

Markus


[-- Attachment #2: mi-catch.diff --]
[-- Type: text/x-patch, Size: 1893 bytes --]

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.220
diff -u -r1.220 breakpoint.c
--- breakpoint.c	16 Jan 2006 12:55:18 -0000	1.220
+++ breakpoint.c	28 Jan 2006 12:52:59 -0000
@@ -2167,17 +2167,41 @@
 
     case bp_catch_fork:
       annotate_catchpoint (bs->breakpoint_at->number);
-      printf_filtered (_("\nCatchpoint %d (forked process %d), "),
-		       bs->breakpoint_at->number, 
-		       bs->breakpoint_at->forked_inferior_pid);
+      if (ui_out_is_mi_like_p (uiout))
+      {
+	ui_out_text (uiout, "\nBreakpoint ");
+	ui_out_field_string (uiout, "reason", "fork");
+	ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number);
+	ui_out_field_int (uiout, "forked-process",
+			  bs->breakpoint_at->forked_inferior_pid);
+	ui_out_text (uiout, ", ");
+      }
+      else
+      {
+	printf_filtered (_("\nCatchpoint %d (forked process %d), "),
+			 bs->breakpoint_at->number, 
+			 bs->breakpoint_at->forked_inferior_pid);
+      }
       return PRINT_SRC_AND_LOC;
       break;
 
     case bp_catch_vfork:
       annotate_catchpoint (bs->breakpoint_at->number);
-      printf_filtered (_("\nCatchpoint %d (vforked process %d), "),
-		       bs->breakpoint_at->number, 
-		       bs->breakpoint_at->forked_inferior_pid);
+      if (ui_out_is_mi_like_p (uiout))
+      {
+	ui_out_text (uiout, "\nBreakpoint ");
+	ui_out_field_string (uiout, "reason", "vfork");
+	ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number);
+	ui_out_field_int (uiout, "forked-process",
+			  bs->breakpoint_at->forked_inferior_pid);
+	ui_out_text (uiout, ", ");
+      }
+      else
+      {
+	printf_filtered (_("\nCatchpoint %d (vforked process %d), "),
+			 bs->breakpoint_at->number, 
+			 bs->breakpoint_at->forked_inferior_pid);
+      }
       return PRINT_SRC_AND_LOC;
       break;
 

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: minimalistic MI catch support
@ 2006-02-09  6:28 Nick Roberts
  2006-02-10  6:34 ` Nick Roberts
  0 siblings, 1 reply; 15+ messages in thread
From: Nick Roberts @ 2006-02-09  6:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Daniel Jacobowitz, Markus Schiltknecht, Bob Rossi


[I srewed up the header first time, hopefully not this time, apologies if you
get two copies.  I'm not subscribed to gdb-patches and would like to be cc'ed
in any threads on MI, if possible.]

I've not used catchpoints, so I just have a couple of minor observations.


>      case bp_catch_vfork:
>        annotate_catchpoint (bs->breakpoint_at->number);
> -      printf_filtered (_("\nCatchpoint %d (vforked process %d), "),
> -		       bs->breakpoint_at->number, 
> -		       bs->breakpoint_at->forked_inferior_pid);
> +      ui_out_text (uiout, "\nCatchpoint ");
> +      if (ui_out_is_mi_like_p (uiout))
> +	ui_out_field_string (uiout, "reason",
> +			     async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
> +      ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number);
> +      ui_out_text (uiout, " (vforked process ");
> +      ui_out_field_int (uiout, "vforked-process",
> +			bs->breakpoint_at->forked_inferior_pid);

I realise that this method of combining CLI and MI output is already used in
breakpoint.c but presumably it has the unfortunate side effect of not
translating some CLI output intended for the user.  For example "breakpoint"
and "catchpoint may be translated in some places but not others.

The manual says:

    `exec'
          A call to `exec'.  This is currently only available for HP-UX.

    `fork'
          A call to `fork'.  This is currently only available for HP-UX.

    `vfork'
          A call to `vfork'.  This is currently only available for
          HP-UX.

Is that still true?  I can certainly set catchpoints for these with GNU/Linux.

> > *stopped,reason="catchpoint-hit",catchpoint-kind="vfork",bkptno="1",forked-process="6570",thread-id="0",frame={addr="0x00002aaaaaeb6462",func="fork",args=[],from="/lib/libc.so.6"}

> I like this.

With reason="breakpoint-hit" it's nature (catch vfork) can be deduced from
bkptno="1" and -break-list or just "-break-info 1" but I guess there's no harm
in redundant information.


Nick                                           http://www.inet.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2006-02-10 20:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-28 13:04 minimalistic MI catch support Markus Schiltknecht
2006-02-06 23:29 ` Daniel Jacobowitz
2006-02-07  1:15   ` Bob Rossi
2006-02-07  3:00     ` Daniel Jacobowitz
2006-02-07 12:01       ` Markus Schiltknecht
2006-02-09  6:28 Nick Roberts
2006-02-10  6:34 ` Nick Roberts
2006-02-10 11:25   ` Eli Zaretskii
2006-02-10 14:11     ` Daniel Jacobowitz
2006-02-10 15:41       ` Eli Zaretskii
2006-02-10 16:48         ` Daniel Jacobowitz
2006-02-10 18:40           ` Eli Zaretskii
2006-02-10 18:52             ` Daniel Jacobowitz
2006-02-10 20:17       ` Nick Roberts
2006-02-10 20:20         ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox