From: DJ Delorie <dj@redhat.com>
To: Mahesh Basavaraj Shavari <Mahesh.Shavari@kpitcummins.com>
Cc: gdb@sourceware.org, kevinb@redhat.com
Subject: Re: Mingw GDB build fails for M16C target
Date: Fri, 14 Aug 2009 04:24:00 -0000 [thread overview]
Message-ID: <200908140424.n7E4OW7M007380@greed.delorie.com> (raw)
In-Reply-To: <F56EA673D3E56E48804FE2B0D23EFD2D1BB8D59602@KCINPUNHJCMS01.kpit.com> (message from Mahesh Basavaraj Shavari on Wed, 5 Aug 2009 18:29:03 +0530)
> There is still following issue with simulator building:
Fixed.
2009-08-14 DJ Delorie <dj@redhat.com>
* configure.in: Check for sys/select.h, termios.h, sys/socket.h,
netinet/in.h, and netinet/tcp.h.
* configure: Regenerate.
* config.in: Add those headers.
* main.c: Check for them.
(setup_tcp_console): Disable if no networking.
(main): Note missing networking or termios.
* mem.c: Check for those headers.
(stdin_ready): Disable if no termios.
(m32c_sim_restore_console): Disable if no termios.
(mem_get_byte): Disable console input if no termios.
Index: config.in
===================================================================
RCS file: /cvs/src/src/sim/m32c/config.in,v
retrieving revision 1.2
diff -p -U3 -r1.2 config.in
--- config.in 11 Jul 2008 02:37:08 -0000 1.2
+++ config.in 14 Aug 2009 04:23:06 -0000
@@ -22,6 +22,12 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#undef HAVE_NETINET_TCP_H
+
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
@@ -49,15 +55,24 @@
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
+/* Define to 1 if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
/* Define to 1 if you have the `time' function. */
#undef HAVE_TIME
Index: configure.in
===================================================================
RCS file: /cvs/src/src/sim/m32c/configure.in,v
retrieving revision 1.5
diff -p -U3 -r1.5 configure.in
--- configure.in 14 Jan 2009 10:53:07 -0000 1.5
+++ configure.in 14 Aug 2009 04:23:06 -0000
@@ -28,4 +28,6 @@ sinclude(../common/aclocal.m4)
# it by inlining the macro's contents.
sinclude(../common/common.m4)
+AC_CHECK_HEADERS(sys/select.h termios.h sys/socket.h netinet/in.h netinet/tcp.h)
+
SIM_AC_OUTPUT
Index: main.c
===================================================================
RCS file: /cvs/src/src/sim/m32c/main.c,v
retrieving revision 1.7
diff -p -U3 -r1.7 main.c
--- main.c 14 Jan 2009 10:53:07 -0000 1.7
+++ main.c 14 Aug 2009 04:23:06 -0000
@@ -19,6 +19,7 @@ You should have received a copy of the G
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -26,11 +27,21 @@ along with this program. If not, see <h
#include <assert.h>
#include <setjmp.h>
#include <signal.h>
-
#include <sys/types.h>
+
+#ifdef HAVE_SYS_SOCKET_H
+#ifdef HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_TCP_H
+#define HAVE_networking
+#endif
+#endif
+#endif
+
+#ifdef HAVE_networking
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
+#endif
#include "bfd.h"
@@ -45,8 +56,10 @@ along with this program. If not, see <h
#include "timer_a.h"
#endif
+#ifdef HAVE_networking
extern int m32c_console_ofd;
extern int m32c_console_ifd;
+#endif
int m32c_disassemble = 0;
static unsigned int cycles = 0;
@@ -63,6 +76,7 @@ done (int exit_code)
exit (exit_code);
}
+#ifdef HAVE_networking
static void
setup_tcp_console (char *portname)
{
@@ -109,6 +123,7 @@ setup_tcp_console (char *portname)
printf ("connection from %d.%d.%d.%d\n", a[0], a[1], a[2], a[3]);
m32c_console_ofd = m32c_console_ifd;
}
+#endif
int
main (int argc, char **argv)
@@ -116,7 +131,9 @@ main (int argc, char **argv)
int o;
int save_trace;
bfd *prog;
+#ifdef HAVE_networking
char *console_port_s = 0;
+#endif
setbuf (stdout, 0);
@@ -129,10 +146,18 @@ main (int argc, char **argv)
trace++;
break;
case 'c':
+#ifdef HAVE_networking
console_port_s = optarg;
+#else
+ fprintf (stderr, "Nework console not available in this build.\n");
+#endif
break;
case 'C':
+#ifdef HAVE_TERMIOS_H
m32c_use_raw_console = 1;
+#else
+ fprintf (stderr, "Raw console not available in this build.\n");
+#endif
break;
case 'v':
verbose++;
@@ -177,8 +202,10 @@ main (int argc, char **argv)
m32c_load (prog);
trace = save_trace;
+#ifdef HAVE_networking
if (console_port_s)
setup_tcp_console (console_port_s);
+#endif
sim_disasm_init (prog);
Index: mem.c
===================================================================
RCS file: /cvs/src/src/sim/m32c/mem.c,v
retrieving revision 1.9
diff -p -U3 -r1.9 mem.c
--- mem.c 14 Jan 2009 10:53:07 -0000 1.9
+++ mem.c 14 Aug 2009 04:23:07 -0000
@@ -19,6 +19,7 @@ You should have received a copy of the G
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -26,8 +27,12 @@ along with this program. If not, see <h
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
+#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
+#endif
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
+#endif
#include "mem.h"
#include "cpu.h"
@@ -48,9 +53,13 @@ along with this program. If not, see <h
static unsigned char **pt[L1_LEN];
+#ifdef HAVE_TERMIOS_H
int m32c_console_ifd = 0;
+#endif
int m32c_console_ofd = 1;
+#ifdef HAVE_TERMIOS_H
int m32c_use_raw_console = 0;
+#endif
#ifdef TIMER_A
Timer_A timer_a;
@@ -374,6 +383,7 @@ mem_get_pc ()
return *m;
}
+#ifdef HAVE_TERMIOS_H
static int console_raw = 0;
static struct termios oattr;
@@ -399,6 +409,7 @@ m32c_sim_restore_console ()
tcsetattr (m32c_console_ifd, TCSANOW, &oattr);
console_raw = 0;
}
+#endif
static unsigned char
mem_get_byte (int address)
@@ -408,6 +419,7 @@ mem_get_byte (int address)
m = mem_ptr (address);
switch (address)
{
+#ifdef HAVE_TERMIOS_H
case 0x2ed: /* m32c uart1c1 */
case 0x3ad: /* m16c uart1c1 */
@@ -447,6 +459,7 @@ mem_get_byte (int address)
}
return c;
}
+#endif
#ifdef TIMER_A
case 0x346: /* TA0low */
@@ -457,6 +470,9 @@ mem_get_byte (int address)
return timer_a.count;
#endif
+ default:
+ /* In case both cases above are not included. */
+ ;
}
S ("=>");
next prev parent reply other threads:[~2009-08-14 4:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-05 12:59 Mahesh Basavaraj Shavari
2009-08-14 4:24 ` DJ Delorie [this message]
2009-08-20 14:32 ` Issue in MinGW GDB execution for M32C target Mahesh Basavaraj Shavari
-- strict thread matches above, loose matches on Subject: below --
2009-04-29 8:40 Mingw GDB build fails for M16C target Mahesh Basavaraj Shavari
2009-04-25 13:57 Mahesh Basavaraj Shavari
2009-04-29 6:13 ` Kevin Buettner
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=200908140424.n7E4OW7M007380@greed.delorie.com \
--to=dj@redhat.com \
--cc=Mahesh.Shavari@kpitcummins.com \
--cc=gdb@sourceware.org \
--cc=kevinb@redhat.com \
/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