Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: Denis PILAT <denis.pilat@st.com>,
		gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC] -thread-info new command
Date: Tue, 27 Mar 2007 19:54:00 -0000	[thread overview]
Message-ID: <20070327195414.GN28164@caradoc.them.org> (raw)
In-Reply-To: <17921.40699.742164.983281@kahikatea.snap.net.nz>

On Thu, Mar 22, 2007 at 09:09:15AM +1200, Nick Roberts wrote:
> I've gone through the archives to try to understand the changes.   The above
> message says:
> 
>    Well we need to propagate the error message back to
>    captured_mi_execute_command.
> 
> Actually there are currently two ways to catch an error in MI:
> 
> 1) Using error () and catch_exception.
> 
> 2) Using MI_CMD_ERROR and mi_error_message.
> 
> The first gets caught in mi_execute_command and the error message is stored
> in result.message.  The second goes back to captured_mi_execute_command and
> the error message is manually stored in mi_error_message.
> 
> I think that only one method should be used and this should be the first one.

Once upon a time there were supposed to be more things using "libgdb"
- these gdb_* wrapper functions.  It didn't come to pass.

For now can we do the minimal fix for this problem?  I apologize I was
never clear enough about what I meant when I said that, so here's a
patch.  Before:

-break-insert *
&"Argument required (expression to compute).\n"
^done

After:

-break-insert *
&"Argument required (expression to compute).\n"
^error,msg="Argument required (expression to compute)."

I'm running the testsuite on this now.

-- 
Daniel Jacobowitz
CodeSourcery

2007-03-27  Daniel Jacobowitz  <dan@codesourcery.com>

	* breakpoint.c (gdb_breakpoint_query): Really return an
	enum gdb_rc.
	(gdb_breakpoint): Likewise.
	* thread.c (do_captured_list_thread_ids): Likewise.
	(do_captured_thread_select): Likewise.
	* mi/mi-main.c (mi_cmd_thread_select): Expect an enum gdb_rc.
	(mi_cmd_thread_list_ids): Remove bogus initialization.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.242
diff -u -p -r1.242 breakpoint.c
--- breakpoint.c	9 Mar 2007 16:20:42 -0000	1.242
+++ breakpoint.c	27 Mar 2007 19:51:50 -0000
@@ -3755,8 +3755,11 @@ gdb_breakpoint_query (struct ui_out *uio
   args.bnum = bnum;
   /* For the moment we don't trust print_one_breakpoint() to not throw
      an error. */
-  return catch_exceptions_with_msg (uiout, do_captured_breakpoint_query, &args,
-				    error_message, RETURN_MASK_ALL);
+  if (catch_exceptions_with_msg (uiout, do_captured_breakpoint_query, &args,
+				 error_message, RETURN_MASK_ALL) < 0)
+    return GDB_RC_FAIL;
+  else
+    return GDB_RC_OK;
 }
 
 /* Return non-zero if B is user settable (breakpoints, watchpoints,
@@ -5598,8 +5601,11 @@ gdb_breakpoint (char *address, char *con
   args.tempflag = tempflag;
   args.thread = thread;
   args.ignore_count = ignore_count;
-  return catch_exceptions_with_msg (uiout, do_captured_breakpoint, &args,
-				    error_message, RETURN_MASK_ALL);
+  if (catch_exceptions_with_msg (uiout, do_captured_breakpoint, &args,
+				 error_message, RETURN_MASK_ALL) < 0)
+    return GDB_RC_FAIL;
+  else
+    return GDB_RC_OK;
 }
 
 
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.51
diff -u -p -r1.51 thread.c
--- thread.c	28 Feb 2007 17:35:01 -0000	1.51
+++ thread.c	27 Mar 2007 19:51:50 -0000
@@ -286,8 +286,10 @@ do_captured_list_thread_ids (struct ui_o
 enum gdb_rc
 gdb_list_thread_ids (struct ui_out *uiout, char **error_message)
 {
-  return catch_exceptions_with_msg (uiout, do_captured_list_thread_ids, NULL,
-				    error_message, RETURN_MASK_ALL);
+  if (catch_exceptions_with_msg (uiout, do_captured_list_thread_ids, NULL,
+				 error_message, RETURN_MASK_ALL) < 0)
+    return GDB_RC_FAIL;
+  return GDB_RC_OK;
 }
 
 /* Load infrun state for the thread PID.  */
@@ -707,8 +709,10 @@ do_captured_thread_select (struct ui_out
 enum gdb_rc
 gdb_thread_select (struct ui_out *uiout, char *tidstr, char **error_message)
 {
-  return catch_exceptions_with_msg (uiout, do_captured_thread_select, tidstr,
-				    error_message, RETURN_MASK_ALL);
+  if (catch_exceptions_with_msg (uiout, do_captured_thread_select, tidstr,
+				 error_message, RETURN_MASK_ALL) < 0)
+    return GDB_RC_FAIL;
+  return GDB_RC_OK;
 }
 
 /* Commands with a prefix of `thread'.  */
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.94
diff -u -p -r1.94 mi-main.c
--- mi/mi-main.c	3 Feb 2007 05:41:15 -0000	1.94
+++ mi/mi-main.c	27 Mar 2007 19:51:50 -0000
@@ -253,11 +253,7 @@ mi_cmd_thread_select (char *command, cha
   else
     rc = gdb_thread_select (uiout, argv[0], &mi_error_message);
 
-  /* RC is enum gdb_rc if it is successful (>=0)
-     enum return_reason if not (<0).  */
-  if ((int) rc < 0 && (enum return_reason) rc == RETURN_ERROR)
-    return MI_CMD_ERROR;
-  else if ((int) rc >= 0 && rc == GDB_RC_FAIL)
+  if (rc == GDB_RC_FAIL)
     return MI_CMD_ERROR;
   else
     return MI_CMD_DONE;
@@ -266,7 +262,7 @@ mi_cmd_thread_select (char *command, cha
 enum mi_cmd_result
 mi_cmd_thread_list_ids (char *command, char **argv, int argc)
 {
-  enum gdb_rc rc = MI_CMD_DONE;
+  enum gdb_rc rc;
 
   if (argc != 0)
     {


  parent reply	other threads:[~2007-03-27 19:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19 14:30 Denis PILAT
2007-03-20  1:44 ` Nick Roberts
2007-03-20  3:09   ` Nick Roberts
2007-03-20  3:14     ` Daniel Jacobowitz
2007-03-20  3:26       ` Nick Roberts
2007-03-21 21:09         ` Nick Roberts
2007-03-22  4:35           ` [RFC] gdb_breakpoint " Nick Roberts
2007-03-27 19:54           ` Daniel Jacobowitz [this message]
2007-03-27 21:36             ` Nick Roberts
2007-04-04 14:36               ` Denis PILAT
2007-04-10 15:14                 ` Daniel Jacobowitz
2007-04-10 14:53               ` Daniel Jacobowitz
2007-04-10 21:54                 ` Nick Roberts
2007-04-10 22:04                   ` Daniel Jacobowitz
2007-04-11  1:16                     ` Nick Roberts

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=20070327195414.GN28164@caradoc.them.org \
    --to=drow@false.org \
    --cc=denis.pilat@st.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nickrob@snap.net.nz \
    /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