gdb: Remove vec.{c,h} and update code to not include vec.h

Removes vec.c and vec.h from the source tree, and remove all the
remaining includes of vec.h.  There should be no user visible changes
after this commit.

I did have a few issues rebuilding GDB after applying this patch due
to cached dependencies, I found that running this command in the build
directory resolved my build issues without requiring a 'make clean':

    rm -fr gdb/gdbserver/gdbsupport/.deps/

gdb/ChangeLog:

	* Makefile.in: Remove references to vec.h and vec.c.
	* aarch64-tdep.c: No longer include vec.h.
	* ada-lang.c: Likewise.
	* ada-lang.h: Likewise.
	* arm-tdep.c: Likewise.
	* ax.h: Likewise.
	* breakpoint.h: Likewise.
	* charset.c: Likewise.
	* cp-support.h: Likewise.
	* dtrace-probe.c: Likewise.
	* dwarf2read.c: Likewise.
	* extension.h: Likewise.
	* gdb_bfd.c: Likewise.
	* gdbsupport/gdb_vecs.h: Likewise.
	* gdbsupport/vec.c: Remove.
	* gdbsupport/vec.h: Remove.
	* gdbthread.h: Likewise.
	* guile/scm-type.c: Likewise.
	* inline-frame.c: Likewise.
	* machoread.c: Likewise.
	* memattr.c: Likewise.
	* memrange.h: Likewise.
	* namespace.h: Likewise.
	* nat/linux-btrace.h: Likewise.
	* osdata.c: Likewise.
	* parser-defs.h: Likewise.
	* progspace.h: Likewise.
	* python/py-type.c: Likewise.
	* record-btrace.c: Likewise.
	* rust-exp.y: Likewise.
	* solib-target.c: Likewise.
	* stap-probe.c: Likewise.
	* target-descriptions.c: Likewise.
	* target-memory.c: Likewise.
	* target.h: Likewise.
	* varobj.c: Likewise.
	* varobj.h: Likewise.
	* xml-support.h: Likewise.

gdb/gdbserver/ChangeLog:

	* Makefile.in: Remove references to vec.c.

Change-Id: I0c91d7170bf1b5e992a387fcd9fe4f2abe343bb5
This commit is contained in:
Andrew Burgess 2019-10-07 16:38:53 +01:00
parent ae6400219c
commit 0dc327459b
41 changed files with 45 additions and 1312 deletions

View File

@ -1,3 +1,44 @@
2019-10-15 Andrew Burgess <andrew.burgess@embecosm.com>
* Makefile.in: Remove references to vec.h and vec.c.
* aarch64-tdep.c: No longer include vec.h.
* ada-lang.c: Likewise.
* ada-lang.h: Likewise.
* arm-tdep.c: Likewise.
* ax.h: Likewise.
* breakpoint.h: Likewise.
* charset.c: Likewise.
* cp-support.h: Likewise.
* dtrace-probe.c: Likewise.
* dwarf2read.c: Likewise.
* extension.h: Likewise.
* gdb_bfd.c: Likewise.
* gdbsupport/gdb_vecs.h: Likewise.
* gdbsupport/vec.c: Remove.
* gdbsupport/vec.h: Remove.
* gdbthread.h: Likewise.
* guile/scm-type.c: Likewise.
* inline-frame.c: Likewise.
* machoread.c: Likewise.
* memattr.c: Likewise.
* memrange.h: Likewise.
* namespace.h: Likewise.
* nat/linux-btrace.h: Likewise.
* osdata.c: Likewise.
* parser-defs.h: Likewise.
* progspace.h: Likewise.
* python/py-type.c: Likewise.
* record-btrace.c: Likewise.
* rust-exp.y: Likewise.
* solib-target.c: Likewise.
* stap-probe.c: Likewise.
* target-descriptions.c: Likewise.
* target-memory.c: Likewise.
* target.h: Likewise.
* varobj.c: Likewise.
* varobj.h: Likewise.
* xml-support.h: Likewise.
2019-10-15 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb/dwarf2read.c (dwarf2_per_objfile::~dwarf2_per_objfile):

View File

@ -980,7 +980,6 @@ COMMON_SFILES = \
gdbsupport/signals.c \
gdbsupport/signals-state-save-restore.c \
gdbsupport/tdesc.c \
gdbsupport/vec.c \
gdbsupport/xml-utils.c \
complaints.c \
completer.c \
@ -1480,7 +1479,6 @@ HFILES_NO_SRCDIR = \
gdbsupport/signals-state-save-restore.h \
gdbsupport/symbol.h \
gdbsupport/tdesc.h \
gdbsupport/vec.h \
gdbsupport/version.h \
gdbsupport/x86-xstate.h \
gdbsupport/xml-utils.h \

View File

@ -52,8 +52,6 @@
#include "elf-bfd.h"
#include "elf/aarch64.h"
#include "gdbsupport/vec.h"
#include "record.h"
#include "record-full.h"
#include "arch/aarch64-insn.h"

View File

@ -49,7 +49,6 @@
#include "valprint.h"
#include "source.h"
#include "observable.h"
#include "gdbsupport/vec.h"
#include "stack.h"
#include "gdbsupport/gdb_vecs.h"
#include "typeprint.h"

View File

@ -28,7 +28,6 @@ struct parser_state;
#include "value.h"
#include "gdbtypes.h"
#include "breakpoint.h"
#include "gdbsupport/vec.h"
/* Names of specific files known to be part of the runtime
system and that might consider (confusing) debugging information.

View File

@ -55,8 +55,6 @@
#include "coff/internal.h"
#include "elf/arm.h"
#include "gdbsupport/vec.h"
#include "record.h"
#include "record-full.h"
#include <algorithm>

View File

@ -19,8 +19,6 @@
#ifndef AX_H
#define AX_H
#include "gdbsupport/vec.h"
/* It's sometimes useful to be able to debug programs that you can't
really stop for more than a fraction of a second. To this end, the
user can specify a tracepoint (like a breakpoint, but you don't

View File

@ -21,7 +21,6 @@
#include "frame.h"
#include "value.h"
#include "gdbsupport/vec.h"
#include "ax.h"
#include "command.h"
#include "gdbsupport/break-common.h"

View File

@ -23,7 +23,6 @@
#include "gdb_obstack.h"
#include "gdbsupport/gdb_wait.h"
#include "charset-list.h"
#include "gdbsupport/vec.h"
#include "gdbsupport/environ.h"
#include "arch-utils.h"
#include "gdbsupport/gdb_vecs.h"

View File

@ -25,7 +25,6 @@
/* We need this for 'domain_enum', alas... */
#include "symtab.h"
#include "gdbsupport/vec.h"
#include "gdbsupport/gdb_vecs.h"
#include "gdb_obstack.h"
#include "gdbsupport/array-view.h"

View File

@ -21,7 +21,6 @@
#include "defs.h"
#include "probe.h"
#include "gdbsupport/vec.h"
#include "elf-bfd.h"
#include "gdbtypes.h"
#include "obstack.h"

View File

@ -55,7 +55,6 @@
#include "addrmap.h"
#include "typeprint.h"
#include "psympriv.h"
#include "gdbsupport/vec.h"
#include "c-lang.h"
#include "go-lang.h"
#include "valprint.h"

View File

@ -21,7 +21,6 @@
#define EXTENSION_H
#include "mi/mi-cmds.h" /* For PRINT_NO_VALUES, etc. */
#include "gdbsupport/vec.h"
#include "gdbsupport/array-view.h"
struct breakpoint;

View File

@ -23,7 +23,6 @@
#include "gdbcmd.h"
#include "hashtab.h"
#include "gdbsupport/filestuff.h"
#include "gdbsupport/vec.h"
#ifdef HAVE_MMAP
#include <sys/mman.h>
#ifndef MAP_FAILED

View File

@ -1,3 +1,7 @@
2019-10-15 Andrew Burgess <andrew.burgess@embecosm.com>
* Makefile.in: Remove references to vec.c.
2019-10-02 Christian Biesinger <cbiesinger@google.com>
* server.c (server_waiting): Change to bool.

View File

@ -221,7 +221,6 @@ SFILES = \
$(srcdir)/gdbsupport/ptid.c \
$(srcdir)/gdbsupport/rsp-low.c \
$(srcdir)/gdbsupport/tdesc.c \
$(srcdir)/gdbsupport/vec.c \
$(srcdir)/gdbsupport/xml-utils.c \
$(srcdir)/nat/aarch64-sve-linux-ptrace.c \
$(srcdir)/nat/linux-btrace.c \
@ -270,7 +269,6 @@ OBS = \
gdbsupport/signals.o \
gdbsupport/signals-state-save-restore.o \
gdbsupport/tdesc.o \
gdbsupport/vec.o \
gdbsupport/xml-utils.o \
debug.o \
dll.o \

View File

@ -20,8 +20,6 @@
#ifndef COMMON_GDB_VECS_H
#define COMMON_GDB_VECS_H
#include "vec.h"
/* Split STR, a list of DELIMITER-separated fields, into a char pointer vector.
You may modify the returned strings. */

View File

@ -1,118 +0,0 @@
/* Vector API for GDB.
Copyright (C) 2004-2019 Free Software Foundation, Inc.
Contributed by Nathan Sidwell <nathan@codesourcery.com>
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/>. */
#include "common-defs.h"
#include "vec.h"
struct vec_prefix
{
unsigned num;
unsigned alloc;
void *vec[1];
};
/* Calculate the new ALLOC value, making sure that abs(RESERVE) slots
are free. If RESERVE < 0 grow exactly, otherwise grow
exponentially. */
static inline unsigned
calculate_allocation (const struct vec_prefix *pfx, int reserve)
{
unsigned alloc = 0;
unsigned num = 0;
if (pfx)
{
alloc = pfx->alloc;
num = pfx->num;
}
else if (!reserve)
/* If there's no prefix, and we've not requested anything, then we
will create a NULL vector. */
return 0;
/* We must have run out of room. */
gdb_assert (alloc - num < (unsigned)(reserve < 0 ? -reserve : reserve));
if (reserve < 0)
/* Exact size. */
alloc = num + -reserve;
else
{
/* Exponential growth. */
if (!alloc)
alloc = 4;
else if (alloc < 16)
/* Double when small. */
alloc = alloc * 2;
else
/* Grow slower when large. */
alloc = (alloc * 3 / 2);
/* If this is still too small, set it to the right size. */
if (alloc < num + reserve)
alloc = num + reserve;
}
return alloc;
}
/* Ensure there are at least abs(RESERVE) free slots in VEC. If
RESERVE < 0 grow exactly, else grow exponentially. As a special
case, if VEC is NULL, and RESERVE is 0, no vector will be created. */
void *
vec_p_reserve (void *vec, int reserve)
{
return vec_o_reserve (vec, reserve,
offsetof (struct vec_prefix, vec), sizeof (void *));
}
/* As vec_p_reserve, but for object vectors. The vector's trailing
array is at VEC_OFFSET offset and consists of ELT_SIZE sized
elements. */
void *
vec_o_reserve (void *vec, int reserve, size_t vec_offset, size_t elt_size)
{
struct vec_prefix *pfx = (struct vec_prefix *) vec;
unsigned alloc = calculate_allocation (pfx, reserve);
if (!alloc)
return NULL;
vec = xrealloc (vec, vec_offset + alloc * elt_size);
((struct vec_prefix *)vec)->alloc = alloc;
if (!pfx)
((struct vec_prefix *)vec)->num = 0;
return vec;
}
#if 0
/* Example uses. */
DEF_VEC_I (int);
typedef struct X
{
int i;
} obj_t;
typedef obj_t *ptr_t;
DEF_VEC_P (ptr_t);
DEF_VEC_O (obj_t);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,6 @@ struct symtab;
#include "frame.h"
#include "ui-out.h"
#include "btrace.h"
#include "gdbsupport/vec.h"
#include "target/waitstatus.h"
#include "cli/cli-utils.h"
#include "gdbsupport/refcounted-object.h"

View File

@ -26,7 +26,6 @@
#include "gdbtypes.h"
#include "objfiles.h"
#include "language.h"
#include "gdbsupport/vec.h"
#include "bcache.h"
#include "dwarf2loc.h"
#include "typeprint.h"

View File

@ -27,7 +27,6 @@
#include "gdbthread.h"
#include "regcache.h"
#include "symtab.h"
#include "gdbsupport/vec.h"
#include "frame.h"
#include <algorithm>

View File

@ -28,7 +28,6 @@
#include "gdbcore.h"
#include "mach-o.h"
#include "aout/stab_gnu.h"
#include "gdbsupport/vec.h"
#include "psympriv.h"
#include "complaints.h"
#include "gdb_bfd.h"

View File

@ -25,7 +25,6 @@
#include "target-dcache.h"
#include "value.h"
#include "language.h"
#include "gdbsupport/vec.h"
#include "breakpoint.h"
#include "cli/cli-utils.h"
#include <algorithm>

View File

@ -20,8 +20,6 @@
#ifndef MEMRANGE_H
#define MEMRANGE_H
#include "gdbsupport/vec.h"
/* Defines a [START, START + LENGTH) memory range. */
struct mem_range

View File

@ -19,7 +19,6 @@
#ifndef NAMESPACE_H
#define NAMESPACE_H
#include "gdbsupport/vec.h"
#include "gdbsupport/gdb_vecs.h"
#include "gdb_obstack.h"

View File

@ -23,7 +23,6 @@
#define NAT_LINUX_BTRACE_H
#include "gdbsupport/btrace-common.h"
#include "gdbsupport/vec.h"
#if HAVE_LINUX_PERF_EVENT_H
# include <linux/perf_event.h>
#endif

View File

@ -19,7 +19,6 @@
#include "defs.h"
#include "target.h"
#include "gdbsupport/vec.h"
#include "xml-support.h"
#include "osdata.h"
#include "ui-out.h"

View File

@ -23,7 +23,6 @@
#if !defined (PARSER_DEFS_H)
#define PARSER_DEFS_H 1
#include "gdbsupport/vec.h"
#include "expression.h"
#include "symtab.h"

View File

@ -22,7 +22,6 @@
#define PROGSPACE_H
#include "target.h"
#include "gdbsupport/vec.h"
#include "gdb_bfd.h"
#include "gdbsupport/gdb_vecs.h"
#include "registry.h"

View File

@ -26,7 +26,6 @@
#include "demangle.h"
#include "objfiles.h"
#include "language.h"
#include "gdbsupport/vec.h"
#include "typeprint.h"
typedef struct pyty_type_object

View File

@ -38,7 +38,6 @@
#include "infrun.h"
#include "event-loop.h"
#include "inf-loop.h"
#include "gdbsupport/vec.h"
#include "inferior.h"
#include <algorithm>
#include "gdbarch.h"

View File

@ -40,7 +40,6 @@
#include "parser-defs.h"
#include "gdbsupport/selftest.h"
#include "value.h"
#include "gdbsupport/vec.h"
#include "gdbarch.h"
#define GDB_YY_REMAP_PREFIX rust

View File

@ -23,7 +23,6 @@
#include "symtab.h"
#include "symfile.h"
#include "target.h"
#include "gdbsupport/vec.h"
#include "solib-target.h"
#include <vector>

View File

@ -20,7 +20,6 @@
#include "defs.h"
#include "stap-probe.h"
#include "probe.h"
#include "gdbsupport/vec.h"
#include "ui-out.h"
#include "objfiles.h"
#include "arch-utils.h"

View File

@ -26,7 +26,6 @@
#include "reggroups.h"
#include "target.h"
#include "target-descriptions.h"
#include "gdbsupport/vec.h"
#include "xml-support.h"
#include "xml-tdesc.h"
#include "osabi.h"

View File

@ -19,7 +19,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "gdbsupport/vec.h"
#include "target.h"
#include "memory-map.h"

View File

@ -74,7 +74,6 @@ struct inferior;
#include "bfd.h"
#include "symtab.h"
#include "memattr.h"
#include "gdbsupport/vec.h"
#include "gdbsupport/gdb_signals.h"
#include "btrace.h"
#include "record.h"

View File

@ -26,7 +26,6 @@
#include "gdb_regex.h"
#include "varobj.h"
#include "gdbsupport/vec.h"
#include "gdbthread.h"
#include "inferior.h"
#include "varobj-iter.h"

View File

@ -19,7 +19,6 @@
#include "symtab.h"
#include "gdbtypes.h"
#include "gdbsupport/vec.h"
#include "value.h"
/* Enumeration for the format types */

View File

@ -22,7 +22,6 @@
#define XML_SUPPORT_H
#include "gdb_obstack.h"
#include "gdbsupport/vec.h"
#include "gdbsupport/xml-utils.h"
#include "gdbsupport/byte-vector.h"
#include "gdbsupport/gdb_optional.h"