This is the mail archive of the gdb@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]

Re: RFC: GDB as a loader 2/3: return child result


Daniel Jacobowitz wrote:
Sorry, I never got around to looking at the code portion of this. Would you mind making one cleanup for me?

It doesn't really matter which header the externs go in.  But they have
to go in a header, visible at both the point of definition and the
point of use.  No externs in C files.  top.h or main.h should be fine.

Ok. How about the attached modification?


Thanks

Andrew Stubbs
2005-11-07  Andrew Stubbs  <andrew.stubbs@st.com>

	* main.h (return_child_result, return_child_result_value): Declare.
	* infrun.h: Include main.h.
	(print_stop_reason): Remove declaration of return_child_result_value.
	* top.c; Include main.h.
	(quit_force): Remove declarations of return_child_result_value and
	return_child_result.

Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c	2005-11-04 11:42:07.000000000 +0000
+++ src/gdb/infrun.c	2005-11-07 12:00:36.000000000 +0000
@@ -46,6 +46,7 @@
 #include "observer.h"
 #include "language.h"
 #include "solib.h"
+#include "main.h"
 
 #include "gdb_assert.h"
 #include "mi/mi-common.h"
@@ -2931,11 +2932,8 @@ print_stop_reason (enum inferior_stop_re
 	       async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
 	  ui_out_text (uiout, "\nProgram exited normally.\n");
 	}
-      {
-	/* Support the --return-child-result option.  */
-	extern int return_child_result_value;
-	return_child_result_value = stop_info;
-      }
+      /* Support the --return-child-result option.  */
+      return_child_result_value = stop_info;
       break;
     case SIGNAL_RECEIVED:
       /* Signal received. The signal table tells us to print about
Index: src/gdb/main.h
===================================================================
--- src.orig/gdb/main.h	2003-02-13 18:07:24.000000000 +0000
+++ src/gdb/main.h	2005-11-07 11:59:07.000000000 +0000
@@ -32,4 +32,8 @@ struct captured_main_args
 
 extern int gdb_main (struct captured_main_args *);
 
+/* From main.c.  */
+extern int return_child_result;
+extern int return_child_result_value;
+
 #endif
Index: src/gdb/top.c
===================================================================
--- src.orig/gdb/top.c	2005-11-07 11:50:21.000000000 +0000
+++ src/gdb/top.c	2005-11-07 11:56:17.000000000 +0000
@@ -46,6 +46,7 @@
 #include "serial.h"
 #include "doublest.h"
 #include "gdb_assert.h"
+#include "main.h"
 
 /* readline include files */
 #include "readline/readline.h"
@@ -1177,7 +1178,6 @@ quit_force (char *args, int from_tty)
 {
   int exit_code = 0;
   struct qt_args qt;
-  extern int return_child_result, return_child_result_value;
 
   /* An optional expression may be used to cause gdb to terminate with the 
      value of that expression. */

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