[RFA] Remove REALTIME_HI/LO macros from target headers

Ulrich Weigand
2006-11-24T21:13:38Z

Hello,

some of the tm-*.h files define REALTIME_LO and REALTIME_HI. From looking
at the sole user, signals/signals.c, it would appear that this is actually
incorrect. The values should refer to *host* signal numbers, not target
signal numbers, so they shouldn't come from target headers.

However, since signals.c appears to be used only in native configurations,
that doesn't actually matter. On the other hand, this means we can get
those defines out of the tm-*.h files and into the nm-*.h files.

The following files currently define the REALTIME macros:
- config/tm-linux.h and config/mips/tm-linux.h
- config/rs6000/tm-rs6000ly.h
- config/tm-nto.h

For Linux, the nm-linux.h file already defines those macros, so the
definitions in the tm files appear to be fully redundant.

For Neutrino and LynxOS, there exists just a single configuation each,
so I've simply moved the defines to the corresponding nm file.

In testing, I noticed that neither i386-nto nor rs6000-lynxos cross
configurations actually build right now, so I've fixed a couple of
issues to get them to build:
- Add missing includes to nto-tdep.c.
- Define SOLIB_UNLOADED_LIBRARY_PATHNAME as "" instead of (0) in
coff-solib.h.
- Add xcoffread.o to TDEPFILES in rs6000lynx.mt, as otherwise there
is an undefined reference to aix_process_linenos.
- Initialize an uninitialized variable in read_xcoff_symtab.

In addition to building i386-nto and rs6000-lynxos cross-GDBs, I've
fully tested the patch on s390-ibm-linux and s390x-ibm-linux.

OK?

Bye,
Ulrich

ChangeLog:

* config/tm-linux.h (REALTIME_LO, REALTIME_HI): Do not define.
* config/mips/tm-linux.h (REALTIME_LO, REALTIME_HI): Likewise.

* config/rs6000/tm-rs6000ly.h (REALTIME_LO, REALTIME_HI): Move to ...
* config/nm-lynx.h (REALTIME_LO, REALTIME_HI): ... here.

* config/i386/nto.mh (NAT_FILE): Define.
* config/i386/nto.mt (DEPRECATED_TM_FILE): Remove.
* config/i386/tm-nto.h: Delete file.
* config/tm-nto.h: Delete file.
* config/nm-nto.h: New file.

* Makefile.in (nto-tdep.o): Add dependency on $(objfiles_h).
* nto-tdep.c: Include "objfiles.h" and <string.h>.

* coff-solib.h (SOLIB_UNLOADED_LIBRARY_PATHNAME): Define as "".
* xcoffread.c (read_xcoff_symtab): Initialize fcn_stab_saved.
* config/rs6000/rs6000lynx.mt (TDEPFILES): Add xcoffread.o.

diff -x CVS -urN gdb-orig/gdb/coff-solib.h gdb-head/gdb/coff-solib.h
--- gdb-orig/gdb/coff-solib.h 2005-12-17 23:33:59.000000000 +0100
+++ gdb-head/gdb/coff-solib.h 2006-11-24 20:07:08.477223936 +0100
@@ -146,7 +146,7 @@
*/

#define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) \
-(0)
+""

/* This function returns TRUE if pc is the address of an instruction that
lies within the dynamic linker (such as the event hook, or the dld
diff -x CVS -urN gdb-orig/gdb/config/i386/nto.mh gdb-head/gdb/config/i386/nto.mh
--- gdb-orig/gdb/config/i386/nto.mh 2004-09-02 21:52:40.000000000 +0200
+++ gdb-head/gdb/config/i386/nto.mh 2006-11-24 19:32:52.865150432 +0100
@@ -1,3 +1,4 @@
# Host: Intel 386 running QNX.

NATDEPFILES= nto-procfs.o
+NAT_FILE= config/nm-nto.h
diff -x CVS -urN gdb-orig/gdb/config/i386/nto.mt gdb-head/gdb/config/i386/nto.mt
--- gdb-orig/gdb/config/i386/nto.mt 2005-05-24 17:42:30.000000000 +0200
+++ gdb-head/gdb/config/i386/nto.mt 2006-11-24 19:34:00.120179160 +0100
@@ -1,4 +1,3 @@
# Target: Intel 386 running qnx6.
TDEPFILES = i386-tdep.o i387-tdep.o corelow.o solib.o solib-svr4.o \
i386-nto-tdep.o nto-tdep.o
-DEPRECATED_TM_FILE = tm-nto.h
diff -x CVS -urN gdb-orig/gdb/config/i386/tm-nto.h gdb-head/gdb/config/i386/tm-nto.h
--- gdb-orig/gdb/config/i386/tm-nto.h 2006-11-24 20:01:33.252193472 +0100
+++ gdb-head/gdb/config/i386/tm-nto.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,29 +0,0 @@
-/* QNX Neutrino target header.
-
- Copyright 2003, 2004 Free Software Foundation, Inc.
-
- This code was donated by QNX Software Systems Ltd.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef TM_NTO_H
-#define TM_NTO_H 1
-
-#include "config/tm-nto.h"
-
-#endif /* TM_NTO_H */
diff -x CVS -urN gdb-orig/gdb/config/mips/tm-linux.h gdb-head/gdb/config/mips/tm-linux.h
--- gdb-orig/gdb/config/mips/tm-linux.h 2004-10-31 21:36:35.000000000 +0100
+++ gdb-head/gdb/config/mips/tm-linux.h 2006-11-24 19:29:47.263134016 +0100
@@ -22,13 +22,6 @@
#ifndef TM_MIPSLINUX_H
#define TM_MIPSLINUX_H

-/* GNU/Linux MIPS has __SIGRTMAX == 127. */
-
-#ifndef REALTIME_LO
-#define REALTIME_LO 32
-#define REALTIME_HI 128
-#endif
-
#include "config/tm-linux.h"

#undef IN_SOLIB_DYNSYM_RESOLVE_CODE
diff -x CVS -urN gdb-orig/gdb/config/nm-lynx.h gdb-head/gdb/config/nm-lynx.h
--- gdb-orig/gdb/config/nm-lynx.h 2004-09-20 18:39:34.000000000 +0200
+++ gdb-head/gdb/config/nm-lynx.h 2006-11-24 19:34:45.579193992 +0100
@@ -40,6 +40,12 @@
#include <sys/proc.h>
#include "gdbthread.h"

+/* Lynx's signal.h doesn't seem to have any macros for what signal numbers
+ the real-time events are. */
+#define REALTIME_LO 33
+/* One more than the last one. */
+#define REALTIME_HI 64
+
/* This is the amount to subtract from u.u_ar0 to get the offset in
the core file of the register values. */

diff -x CVS -urN gdb-orig/gdb/config/nm-nto.h gdb-head/gdb/config/nm-nto.h
--- gdb-orig/gdb/config/nm-nto.h 1970-01-01 01:00:00.000000000 +0100
+++ gdb-head/gdb/config/nm-nto.h 2006-11-24 19:32:30.583209496 +0100
@@ -0,0 +1,31 @@
+/* Native support for QNX Neutrino version 6.
+
+ Copyright 2003,2006 Free Software Foundation, Inc.
+
+ This code was donated by QNX Software Systems Ltd.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef NM_NTO_H
+#define NM_NTO_H
+
+/* Setup the valid realtime signal range. */
+#define REALTIME_LO 41
+#define REALTIME_HI 56
+
+#endif /* NM_NTO_H */
diff -x CVS -urN gdb-orig/gdb/config/rs6000/rs6000lynx.mt gdb-head/gdb/config/rs6000/rs6000lynx.mt
--- gdb-orig/gdb/config/rs6000/rs6000lynx.mt 2004-09-13 22:55:41.000000000 +0200
+++ gdb-head/gdb/config/rs6000/rs6000lynx.mt 2006-11-24 20:11:38.413198856 +0100
@@ -1,3 +1,3 @@
# Target: IBM RS6000 running LynxOS
-TDEPFILES= coff-solib.o rs6000-tdep.o ppc-sysv-tdep.o solib.o solib-svr4.o
+TDEPFILES= coff-solib.o xcoffread.o rs6000-tdep.o ppc-sysv-tdep.o solib.o solib-svr4.o
DEPRECATED_TM_FILE= tm-rs6000ly.h
diff -x CVS -urN gdb-orig/gdb/config/rs6000/tm-rs6000ly.h gdb-head/gdb/config/rs6000/tm-rs6000ly.h
--- gdb-orig/gdb/config/rs6000/tm-rs6000ly.h 2004-11-14 04:09:26.000000000 +0100
+++ gdb-head/gdb/config/rs6000/tm-rs6000ly.h 2006-11-24 19:35:02.226192232 +0100
@@ -23,12 +23,6 @@

#include "coff-solib.h" /* COFF shared library support */

-/* Lynx's signal.h doesn't seem to have any macros for what signal numbers
- the real-time events are. */
-#define REALTIME_LO 33
-/* One more than the last one. */
-#define REALTIME_HI 64
-
/* Use generic RS6000 definitions. */
#include "rs6000/tm-rs6000.h"

diff -x CVS -urN gdb-orig/gdb/config/tm-linux.h gdb-head/gdb/config/tm-linux.h
--- gdb-orig/gdb/config/tm-linux.h 2006-11-24 20:01:33.066221744 +0100
+++ gdb-head/gdb/config/tm-linux.h 2006-11-24 19:25:50.323201504 +0100
@@ -19,15 +19,6 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */

-/* Pick reasonable defaults for the number of real-time signals. */
-
-#ifndef REALTIME_LO
-#define REALTIME_LO 32
-#endif
-#ifndef REALTIME_HI
-#define REALTIME_HI 64
-#endif
-
/* We need this file for the SOLIB_TRAMPOLINE stuff. */

/* If PC is in a shared library trampoline code, return the PC
diff -x CVS -urN gdb-orig/gdb/config/tm-nto.h gdb-head/gdb/config/tm-nto.h
--- gdb-orig/gdb/config/tm-nto.h 2005-08-12 19:28:57.000000000 +0200
+++ gdb-head/gdb/config/tm-nto.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,33 +0,0 @@
-/* Target machine sub-description for QNX Neutrino version 6.
- This is included by other tm-*.h files to specify nto specific
- stuff.
-
- Copyright 2003 Free Software Foundation, Inc.
-
- This code was donated by QNX Software Systems Ltd.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef _TM_QNXNTO_H
-#define _TM_QNXNTO_H
-
-/* Setup the valid realtime signal range. */
-#define REALTIME_LO 41
-#define REALTIME_HI 56
-
-#endif /* _TM_QNXNTO_H */
diff -x CVS -urN gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in 2006-11-24 20:01:32.526169672 +0100
+++ gdb-head/gdb/Makefile.in 2006-11-24 19:53:35.688227584 +0100
@@ -2407,7 +2407,7 @@
$(gdbthread_h) $(nto_tdep_h) $(command_h) $(regcache_h) $(solib_h)
nto-tdep.o: nto-tdep.c $(gdb_stat_h) $(gdb_string_h) $(nto_tdep_h) $(top_h) \
$(cli_decode_h) $(cli_cmds_h) $(inferior_h) $(gdbarch_h) $(bfd_h) \
- $(elf_bfd_h) $(solib_svr4_h) $(gdbcore_h)
+ $(elf_bfd_h) $(solib_svr4_h) $(gdbcore_h) $(objfiles_h)
objc-exp.o: objc-exp.c $(defs_h) $(gdb_string_h) $(expression_h) \
$(objc_lang_h) $(value_h) $(parser_defs_h) $(language_h) $(c_lang_h) \
$(bfd_h) $(symfile_h) $(objfiles_h) $(top_h) $(completer_h) \
diff -x CVS -urN gdb-orig/gdb/nto-tdep.c gdb-head/gdb/nto-tdep.c
--- gdb-orig/gdb/nto-tdep.c 2005-12-17 23:34:01.000000000 +0100
+++ gdb-head/gdb/nto-tdep.c 2006-11-24 19:53:48.568133648 +0100
@@ -33,6 +33,9 @@
#include "elf-bfd.h"
#include "solib-svr4.h"
#include "gdbcore.h"
+#include "objfiles.h"
+
+#include <string.h>

#ifdef __CYGWIN__
#include <sys/cygwin.h>
diff -x CVS -urN gdb-orig/gdb/xcoffread.c gdb-head/gdb/xcoffread.c
--- gdb-orig/gdb/xcoffread.c 2006-01-02 05:31:57.000000000 +0100
+++ gdb-head/gdb/xcoffread.c 2006-11-24 20:14:51.497141704 +0100
@@ -925,7 +925,7 @@
int depth = 0;
int fcn_start_addr = 0;

- struct coff_symbol fcn_stab_saved;
+ struct coff_symbol fcn_stab_saved = { 0 };

/* fcn_cs_saved is global because process_xcoff_symbol needs it. */
union internal_auxent fcn_aux_saved;