[v8] Clarify GDBSERVER use in linux-waitpid.c

Message ID 1410516221-19088-1-git-send-email-gbenson@redhat.com
State Committed
Headers

Commit Message

Gary Benson Sept. 12, 2014, 10:03 a.m. UTC
  Pedro Alves wrote:
> Sorry, but now that I see it, IMO the end up resulting code
> doesn't really look better than what we already have.  :-/
> We end up with #ifdef GDBSERVER anyway, so might be best to
> either leave this be until we come up with a complete solution.

Ok, how about this:

This commit makes linux-waitpid.c include common-defs.h.  GDB's
inclusion of defs.h is removed, but gdbserver's inclusion of
server.h remains to support some gdbserver-specific debug code
that cannot presently be merged.  A new FIXME documents this.

gdb/ChangeLog:

	* nat/linux-waitpid.c: Include common-defs.h.
	[GDBSERVER]: Add FIXME comment.
	[!GDBSERVER]: Don't include defs.h or signal.h.
	(linux_debug) [!GDBSERVER]: Remove empty block.
---
 gdb/ChangeLog           |    7 +++++++
 gdb/nat/linux-waitpid.c |   11 ++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)
  

Comments

Pedro Alves Sept. 12, 2014, 10:05 a.m. UTC | #1
On 09/12/2014 11:03 AM, Gary Benson wrote:
> Pedro Alves wrote:
>> Sorry, but now that I see it, IMO the end up resulting code
>> doesn't really look better than what we already have.  :-/
>> We end up with #ifdef GDBSERVER anyway, so might be best to
>> either leave this be until we come up with a complete solution.
> 
> Ok, how about this:
> 
> This commit makes linux-waitpid.c include common-defs.h.  GDB's
> inclusion of defs.h is removed, but gdbserver's inclusion of
> server.h remains to support some gdbserver-specific debug code
> that cannot presently be merged.  A new FIXME documents this.
> 
> gdb/ChangeLog:
> 
> 	* nat/linux-waitpid.c: Include common-defs.h.
> 	[GDBSERVER]: Add FIXME comment.
> 	[!GDBSERVER]: Don't include defs.h or signal.h.
> 	(linux_debug) [!GDBSERVER]: Remove empty block.

OK.

Thanks,
Pedro Alves
  
Gary Benson Sept. 12, 2014, 11:09 a.m. UTC | #2
Pedro Alves wrote:
> On 09/12/2014 11:03 AM, Gary Benson wrote:
> > Pedro Alves wrote:
> > > Sorry, but now that I see it, IMO the end up resulting code
> > > doesn't really look better than what we already have.  :-/
> > > We end up with #ifdef GDBSERVER anyway, so might be best to
> > > either leave this be until we come up with a complete solution.
> > 
> > Ok, how about this:
> > 
> > This commit makes linux-waitpid.c include common-defs.h.  GDB's
> > inclusion of defs.h is removed, but gdbserver's inclusion of
> > server.h remains to support some gdbserver-specific debug code
> > that cannot presently be merged.  A new FIXME documents this.
> > 
> > gdb/ChangeLog:
> > 
> > 	* nat/linux-waitpid.c: Include common-defs.h.
> > 	[GDBSERVER]: Add FIXME comment.
> > 	[!GDBSERVER]: Don't include defs.h or signal.h.
> > 	(linux_debug) [!GDBSERVER]: Remove empty block.
> 
> OK.

Ok, this whole series is pushed now and (barring the comment Doug
wanted changed) complete.  Thanks for the help guys!

Cheers,
Gary
  

Patch

diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index 53847ac..04cdc3d 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -17,11 +17,14 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "common-defs.h"
+
 #ifdef GDBSERVER
+/* FIXME: server.h is required for the definition of debug_threads
+   which is used in the gdbserver-specific debug printing in
+   linux_debug.  This code should be made available to GDB also,
+   but the lack of a suitable flag to enable it prevents this.  */
 #include "server.h"
-#else
-#include "defs.h"
-#include "signal.h"
 #endif
 
 #include "linux-nat.h"
@@ -42,8 +45,6 @@  linux_debug (const char *format, ...)
       vfprintf (stderr, format, args);
       va_end (args);
     }
-#else
-  /* GDB-specific debugging output.  */
 #endif
 }