aboutsummaryrefslogtreecommitdiff
path: root/gdb/common
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-07-30 15:31:10 +0100
committerGary Benson <gbenson@redhat.com>2014-08-19 10:07:19 +0100
commit9239eeabe340e1662c5df8f816785477309e1c0b (patch)
treeb2608885259ccabbe8ce2c73b32dbe8d69f14c42 /gdb/common
parentef87c8bbe7d1c4a987578626655f4a15555c7f4a (diff)
downloadfsf-binutils-gdb-9239eeabe340e1662c5df8f816785477309e1c0b.zip
fsf-binutils-gdb-9239eeabe340e1662c5df8f816785477309e1c0b.tar.gz
fsf-binutils-gdb-9239eeabe340e1662c5df8f816785477309e1c0b.tar.bz2
Introduce common-types.h
This introduces common-types.h. This file defines various standard types used by gdb and gdbserver. Currently these types are conditionally defined based on GDBSERVER. The long term goal is to remove all such tests; however, this is difficult as currently gdb uses definitions from BFD. In the meantime this is still a step in the right direction. gdb/ChangeLog: * common/common-types.h: New file. * Makefile.in (HFILES_NO_SRCDIR): Add common/common-types.h. * common/common-defs.h: Include common-types.h. * defs.h (gdb_byte, CORE_ADDR, CORE_ADDR_MAX, LONGEST) (ULONGEST): Remove. gdb/gdbserver/ChangeLog: * server.h: Add static assertion. (gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Remove.
Diffstat (limited to 'gdb/common')
-rw-r--r--gdb/common/common-defs.h1
-rw-r--r--gdb/common/common-types.h61
2 files changed, 62 insertions, 0 deletions
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index a15423c..5543e4c 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -42,5 +42,6 @@
#include "common-utils.h"
#include "gdb_assert.h"
#include "errors.h"
+#include "common-types.h"
#endif /* COMMON_DEFS_H */
diff --git a/gdb/common/common-types.h b/gdb/common/common-types.h
new file mode 100644
index 0000000..9fa1c24
--- /dev/null
+++ b/gdb/common/common-types.h
@@ -0,0 +1,61 @@
+/* Declarations for common types.
+
+ Copyright (C) 1986-2014 Free Software Foundation, Inc.
+
+ 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 3 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, see <http://www.gnu.org/licenses/>. */
+
+#ifndef COMMON_TYPES_H
+#define COMMON_TYPES_H
+
+#ifdef GDBSERVER
+
+/* * A byte from the program being debugged. */
+typedef unsigned char gdb_byte;
+
+typedef unsigned long long CORE_ADDR;
+
+typedef long long LONGEST;
+typedef unsigned long long ULONGEST;
+
+#else /* GDBSERVER */
+
+#include "bfd.h"
+
+/* * A byte from the program being debugged. */
+typedef bfd_byte gdb_byte;
+
+/* * An address in the program being debugged. Host byte order. */
+typedef bfd_vma CORE_ADDR;
+
+/* This is to make sure that LONGEST is at least as big as CORE_ADDR. */
+
+#ifdef BFD64
+
+typedef BFD_HOST_64_BIT LONGEST;
+typedef BFD_HOST_U_64_BIT ULONGEST;
+
+#else /* No BFD64 */
+
+typedef long long LONGEST;
+typedef unsigned long long ULONGEST;
+
+#endif /* No BFD64 */
+#endif /* GDBSERVER */
+
+/* * The largest CORE_ADDR value. */
+#define CORE_ADDR_MAX (~ (CORE_ADDR) 0)
+
+#endif /* COMMON_TYPES_H */