<HTML> <HEAD> <!-- This HTML file has been created by texi2html 1.51 from /mnt/apple/gdb/source/gdb.apple/source/gdb/gdb/doc/gdbint.texinfo on 23 November 1999 --> <TITLE>GDB Internals - Host Definition</TITLE> </HEAD> <BODY> Go to the <A HREF="gdbint_1.html">first</A>, <A HREF="gdbint_6.html">previous</A>, <A HREF="gdbint_8.html">next</A>, <A HREF="gdbint_16.html">last</A> section, <A HREF="gdbint_toc.html">table of contents</A>. <P><HR><P> <H1><A NAME="SEC42" HREF="gdbint_toc.html#TOC42">Host Definition</A></H1> <P> With the advent of autoconf, it's rarely necessary to have host definition machinery anymore. </P> <H2><A NAME="SEC43" HREF="gdbint_toc.html#TOC43">Adding a New Host</A></H2> <P> Most of GDB's host configuration support happens via autoconf. It should be rare to need new host-specific definitions. GDB still uses the host-specific definitions and files listed below, but these mostly exist for historical reasons, and should eventually disappear. </P> <P> Several files control GDB's configuration for host systems: </P> <DL COMPACT> <DT><TT>`gdb/config/<VAR>arch</VAR>/<VAR>xyz</VAR>.mh'</TT> <DD> Specifies Makefile fragments needed when hosting on machine <VAR>xyz</VAR>. In particular, this lists the required machine-dependent object files, by defining <SAMP>`XDEPFILES=...'</SAMP>. Also specifies the header file which describes host <VAR>xyz</VAR>, by defining <CODE>XM_FILE= xm-<VAR>xyz</VAR>.h</CODE>. You can also define <CODE>CC</CODE>, <CODE>SYSV_DEFINE</CODE>, <CODE>XM_CFLAGS</CODE>, <CODE>XM_ADD_FILES</CODE>, <CODE>XM_CLIBS</CODE>, <CODE>XM_CDEPS</CODE>, etc.; see <TT>`Makefile.in'</TT>. <DT><TT>`gdb/config/<VAR>arch</VAR>/xm-<VAR>xyz</VAR>.h'</TT> <DD> (<TT>`xm.h'</TT> is a link to this file, created by configure). Contains C macro definitions describing the host system environment, such as byte order, host C compiler and library. <DT><TT>`gdb/<VAR>xyz</VAR>-xdep.c'</TT> <DD> Contains any miscellaneous C code required for this machine as a host. On most machines it doesn't exist at all. If it does exist, put <TT>`<VAR>xyz</VAR>-xdep.o'</TT> into the <CODE>XDEPFILES</CODE> line in <TT>`gdb/config/<VAR>arch</VAR>/<VAR>xyz</VAR>.mh'</TT>. </DL> <H3>Generic Host Support Files</H3> <P> There are some "generic" versions of routines that can be used by various systems. These can be customized in various ways by macros defined in your <TT>`xm-<VAR>xyz</VAR>.h'</TT> file. If these routines work for the <VAR>xyz</VAR> host, you can just include the generic file's name (with <SAMP>`.o'</SAMP>, not <SAMP>`.c'</SAMP>) in <CODE>XDEPFILES</CODE>. </P> <P> Otherwise, if your machine needs custom support routines, you will need to write routines that perform the same functions as the generic file. Put them into <CODE><VAR>xyz</VAR>-xdep.c</CODE>, and put <CODE><VAR>xyz</VAR>-xdep.o</CODE> into <CODE>XDEPFILES</CODE>. </P> <DL COMPACT> <DT><TT>`ser-unix.c'</TT> <DD> This contains serial line support for Unix systems. This is always included, via the makefile variable <CODE>SER_HARDWIRE</CODE>; override this variable in the <TT>`.mh'</TT> file to avoid it. <DT><TT>`ser-go32.c'</TT> <DD> This contains serial line support for 32-bit programs running under DOS, using the GO32 execution environment. <DT><TT>`ser-tcp.c'</TT> <DD> This contains generic TCP support using sockets. </DL> <H2><A NAME="SEC44" HREF="gdbint_toc.html#TOC44">Host Conditionals</A></H2> <P> When GDB is configured and compiled, various macros are defined or left undefined, to control compilation based on the attributes of the host system. These macros and their meanings (or if the meaning is not documented here, then one of the source files where they are used is indicated) are: </P> <DL COMPACT> <DT><CODE>GDBINIT_FILENAME</CODE> <DD> The default name of GDB's initialization file (normally <TT>`.gdbinit'</TT>). <DT><CODE>MEM_FNS_DECLARED</CODE> <DD> Your host config file defines this if it includes declarations of <CODE>memcpy</CODE> and <CODE>memset</CODE>. Define this to avoid conflicts between the native include files and the declarations in <TT>`defs.h'</TT>. <DT><CODE>NO_STD_REGS</CODE> <DD> This macro is deprecated. <DT><CODE>NO_SYS_FILE</CODE> <DD> Define this if your system does not have a <CODE><sys/file.h></CODE>. <DT><CODE>SIGWINCH_HANDLER</CODE> <DD> If your host defines <CODE>SIGWINCH</CODE>, you can define this to be the name of a function to be called if <CODE>SIGWINCH</CODE> is received. <DT><CODE>SIGWINCH_HANDLER_BODY</CODE> <DD> Define this to expand into code that will define the function named by the expansion of <CODE>SIGWINCH_HANDLER</CODE>. <DT><CODE>ALIGN_STACK_ON_STARTUP</CODE> <DD> Define this if your system is of a sort that will crash in <CODE>tgetent</CODE> if the stack happens not to be longword-aligned when <CODE>main</CODE> is called. This is a rare situation, but is known to occur on several different types of systems. <DT><CODE>CRLF_SOURCE_FILES</CODE> <DD> Define this if host files use <CODE>\r\n</CODE> rather than <CODE>\n</CODE> as a line terminator. This will cause source file listings to omit <CODE>\r</CODE> characters when printing and it will allow \r\n line endings of files which are "sourced" by gdb. It must be possible to open files in binary mode using <CODE>O_BINARY</CODE> or, for fopen, <CODE>"rb"</CODE>. <DT><CODE>DEFAULT_PROMPT</CODE> <DD> The default value of the prompt string (normally <CODE>"(gdb) "</CODE>). <DT><CODE>DEV_TTY</CODE> <DD> The name of the generic TTY device, defaults to <CODE>"/dev/tty"</CODE>. <DT><CODE>FCLOSE_PROVIDED</CODE> <DD> Define this if the system declares <CODE>fclose</CODE> in the headers included in <CODE>defs.h</CODE>. This isn't needed unless your compiler is unusually anal. <DT><CODE>FOPEN_RB</CODE> <DD> Define this if binary files are opened the same way as text files. <DT><CODE>GETENV_PROVIDED</CODE> <DD> Define this if the system declares <CODE>getenv</CODE> in its headers included in <CODE>defs.h</CODE>. This isn't needed unless your compiler is unusually anal. <DT><CODE>HAVE_MMAP</CODE> <DD> In some cases, use the system call <CODE>mmap</CODE> for reading symbol tables. For some machines this allows for sharing and quick updates. <DT><CODE>HAVE_SIGSETMASK</CODE> <DD> Define this if the host system has job control, but does not define <CODE>sigsetmask()</CODE>. Currently, this is only true of the RS/6000. <DT><CODE>HAVE_TERMIO</CODE> <DD> Define this if the host system has <CODE>termio.h</CODE>. <DT><CODE>HOST_BYTE_ORDER</CODE> <DD> The ordering of bytes in the host. This must be defined to be either <CODE>BIG_ENDIAN</CODE> or <CODE>LITTLE_ENDIAN</CODE>. <DT><CODE>INT_MAX</CODE> <DD> <DT><CODE>INT_MIN</CODE> <DD> <DT><CODE>LONG_MAX</CODE> <DD> <DT><CODE>UINT_MAX</CODE> <DD> <DT><CODE>ULONG_MAX</CODE> <DD> Values for host-side constants. <DT><CODE>ISATTY</CODE> <DD> Substitute for isatty, if not available. <DT><CODE>LONGEST</CODE> <DD> This is the longest integer type available on the host. If not defined, it will default to <CODE>long long</CODE> or <CODE>long</CODE>, depending on <CODE>CC_HAS_LONG_LONG</CODE>. <DT><CODE>CC_HAS_LONG_LONG</CODE> <DD> Define this if the host C compiler supports "long long". This is set by the configure script. <DT><CODE>PRINTF_HAS_LONG_LONG</CODE> <DD> Define this if the host can handle printing of long long integers via the printf format directive "ll". This is set by the configure script. <DT><CODE>HAVE_LONG_DOUBLE</CODE> <DD> Define this if the host C compiler supports "long double". This is set by the configure script. <DT><CODE>PRINTF_HAS_LONG_DOUBLE</CODE> <DD> Define this if the host can handle printing of long double float-point numbers via the printf format directive "Lg". This is set by the configure script. <DT><CODE>SCANF_HAS_LONG_DOUBLE</CODE> <DD> Define this if the host can handle the parsing of long double float-point numbers via the scanf format directive directive "Lg". This is set by the configure script. <DT><CODE>LSEEK_NOT_LINEAR</CODE> <DD> Define this if <CODE>lseek (n)</CODE> does not necessarily move to byte number <CODE>n</CODE> in the file. This is only used when reading source files. It is normally faster to define <CODE>CRLF_SOURCE_FILES</CODE> when possible. <DT><CODE>L_SET</CODE> <DD> This macro is used as the argument to lseek (or, most commonly, bfd_seek). FIXME, should be replaced by SEEK_SET instead, which is the POSIX equivalent. <DT><CODE>MALLOC_INCOMPATIBLE</CODE> <DD> Define this if the system's prototype for <CODE>malloc</CODE> differs from the ANSI definition. <DT><CODE>MMAP_BASE_ADDRESS</CODE> <DD> When using HAVE_MMAP, the first mapping should go at this address. <DT><CODE>MMAP_INCREMENT</CODE> <DD> when using HAVE_MMAP, this is the increment between mappings. <DT><CODE>NEED_POSIX_SETPGID</CODE> <DD> Define this to use the POSIX version of <CODE>setpgid</CODE> to determine whether job control is available. <DT><CODE>NORETURN</CODE> <DD> If defined, this should be one or more tokens, such as <CODE>volatile</CODE>, that can be used in both the declaration and definition of functions to indicate that they never return. The default is already set correctly if compiling with GCC. This will almost never need to be defined. <DT><CODE>ATTR_NORETURN</CODE> <DD> If defined, this should be one or more tokens, such as <CODE>__attribute__ ((noreturn))</CODE>, that can be used in the declarations of functions to indicate that they never return. The default is already set correctly if compiling with GCC. This will almost never need to be defined. <DT><CODE>USE_GENERIC_DUMMY_FRAMES</CODE> <DD> Define this to 1 if the target is using the generic inferior function call code. See <CODE>blockframe.c</CODE> for more information. <DT><CODE>USE_MMALLOC</CODE> <DD> GDB will use the <CODE>mmalloc</CODE> library for memory allocation for symbol reading if this symbol is defined. Be careful defining it since there are systems on which <CODE>mmalloc</CODE> does not work for some reason. One example is the DECstation, where its RPC library can't cope with our redefinition of <CODE>malloc</CODE> to call <CODE>mmalloc</CODE>. When defining <CODE>USE_MMALLOC</CODE>, you will also have to set <CODE>MMALLOC</CODE> in the Makefile, to point to the mmalloc library. This define is set when you configure with --with-mmalloc. <DT><CODE>NO_MMCHECK</CODE> <DD> Define this if you are using <CODE>mmalloc</CODE>, but don't want the overhead of checking the heap with <CODE>mmcheck</CODE>. Note that on some systems, the C runtime makes calls to malloc prior to calling <CODE>main</CODE>, and if <CODE>free</CODE> is ever called with these pointers after calling <CODE>mmcheck</CODE> to enable checking, a memory corruption abort is certain to occur. These systems can still use mmalloc, but must define NO_MMCHECK. <DT><CODE>MMCHECK_FORCE</CODE> <DD> Define this to 1 if the C runtime allocates memory prior to <CODE>mmcheck</CODE> being called, but that memory is never freed so we don't have to worry about it triggering a memory corruption abort. The default is 0, which means that <CODE>mmcheck</CODE> will only install the heap checking functions if there has not yet been any memory allocation calls, and if it fails to install the functions, gdb will issue a warning. This is currently defined if you configure using --with-mmalloc. <DT><CODE>NO_SIGINTERRUPT</CODE> <DD> Define this to indicate that siginterrupt() is not available. <DT><CODE>R_OK</CODE> <DD> Define if this is not in a system .h file. <DT><CODE>SEEK_CUR</CODE> <DD> <DT><CODE>SEEK_SET</CODE> <DD> Define these to appropriate value for the system lseek(), if not already defined. <DT><CODE>STOP_SIGNAL</CODE> <DD> This is the signal for stopping GDB. Defaults to SIGTSTP. (Only redefined for the Convex.) <DT><CODE>USE_O_NOCTTY</CODE> <DD> Define this if the interior's tty should be opened with the O_NOCTTY flag. (FIXME: This should be a native-only flag, but <TT>`inflow.c'</TT> is always linked in.) <DT><CODE>USG</CODE> <DD> Means that System V (prior to SVR4) include files are in use. (FIXME: This symbol is abused in <TT>`infrun.c'</TT>, <TT>`regex.c'</TT>, <TT>`remote-nindy.c'</TT>, and <TT>`utils.c'</TT> for other things, at the moment.) <DT><CODE>lint</CODE> <DD> Define this to help placate lint in some situations. <DT><CODE>volatile</CODE> <DD> Define this to override the defaults of <CODE>__volatile__</CODE> or <CODE>/**/</CODE>. </DL> <P><HR><P> Go to the <A HREF="gdbint_1.html">first</A>, <A HREF="gdbint_6.html">previous</A>, <A HREF="gdbint_8.html">next</A>, <A HREF="gdbint_16.html">last</A> section, <A HREF="gdbint_toc.html">table of contents</A>. </BODY> </HTML>