mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-26 18:53:29 +08:00
1a5c25988e
While working on my other scripts to deal with gdb headers, I noticed that some files were missing include guards. I wrote a script to add the missing ones, but found that using the obvious names for the guards ran into clashes -- for example, gdb/nat/linux-nat.h used "LINUX_NAT_H", but this was also the script's choice for gdb/linux-nat.h. So, I changed the script to normalize all include guards in gdb. This patch is the result. As usual the script is available here: https://github.com/tromey/gdb-refactoring-scripts Tested by rebuilding; I also ran it through "Fedora-x86_64-m64" on the buildbot. gdb/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * yy-remap.h: Add include guard. * xtensa-tdep.h: Add include guard. * xcoffread.h: Rename include guard. * varobj-iter.h: Add include guard. * tui/tui.h: Rename include guard. * tui/tui-winsource.h: Rename include guard. * tui/tui-wingeneral.h: Rename include guard. * tui/tui-windata.h: Rename include guard. * tui/tui-win.h: Rename include guard. * tui/tui-stack.h: Rename include guard. * tui/tui-source.h: Rename include guard. * tui/tui-regs.h: Rename include guard. * tui/tui-out.h: Rename include guard. * tui/tui-layout.h: Rename include guard. * tui/tui-io.h: Rename include guard. * tui/tui-hooks.h: Rename include guard. * tui/tui-file.h: Rename include guard. * tui/tui-disasm.h: Rename include guard. * tui/tui-data.h: Rename include guard. * tui/tui-command.h: Rename include guard. * tic6x-tdep.h: Add include guard. * target/waitstatus.h: Rename include guard. * target/wait.h: Rename include guard. * target/target.h: Rename include guard. * target/resume.h: Rename include guard. * target-float.h: Rename include guard. * stabsread.h: Add include guard. * rs6000-tdep.h: Add include guard. * riscv-fbsd-tdep.h: Add include guard. * regformats/regdef.h: Rename include guard. * record.h: Rename include guard. * python/python.h: Rename include guard. * python/python-internal.h: Rename include guard. * python/py-stopevent.h: Rename include guard. * python/py-ref.h: Rename include guard. * python/py-record.h: Rename include guard. * python/py-record-full.h: Rename include guard. * python/py-record-btrace.h: Rename include guard. * python/py-instruction.h: Rename include guard. * python/py-events.h: Rename include guard. * python/py-event.h: Rename include guard. * procfs.h: Add include guard. * proc-utils.h: Add include guard. * p-lang.h: Add include guard. * or1k-tdep.h: Rename include guard. * observable.h: Rename include guard. * nto-tdep.h: Rename include guard. * nat/x86-linux.h: Rename include guard. * nat/x86-linux-dregs.h: Rename include guard. * nat/x86-gcc-cpuid.h: Add include guard. * nat/x86-dregs.h: Rename include guard. * nat/x86-cpuid.h: Rename include guard. * nat/ppc-linux.h: Rename include guard. * nat/mips-linux-watch.h: Rename include guard. * nat/linux-waitpid.h: Rename include guard. * nat/linux-ptrace.h: Rename include guard. * nat/linux-procfs.h: Rename include guard. * nat/linux-osdata.h: Rename include guard. * nat/linux-nat.h: Rename include guard. * nat/linux-namespaces.h: Rename include guard. * nat/linux-btrace.h: Rename include guard. * nat/glibc_thread_db.h: Rename include guard. * nat/gdb_thread_db.h: Rename include guard. * nat/gdb_ptrace.h: Rename include guard. * nat/fork-inferior.h: Rename include guard. * nat/amd64-linux-siginfo.h: Rename include guard. * nat/aarch64-sve-linux-sigcontext.h: Rename include guard. * nat/aarch64-sve-linux-ptrace.h: Rename include guard. * nat/aarch64-linux.h: Rename include guard. * nat/aarch64-linux-hw-point.h: Rename include guard. * mn10300-tdep.h: Add include guard. * mips-linux-tdep.h: Add include guard. * mi/mi-parse.h: Rename include guard. * mi/mi-out.h: Rename include guard. * mi/mi-main.h: Rename include guard. * mi/mi-interp.h: Rename include guard. * mi/mi-getopt.h: Rename include guard. * mi/mi-console.h: Rename include guard. * mi/mi-common.h: Rename include guard. * mi/mi-cmds.h: Rename include guard. * mi/mi-cmd-break.h: Rename include guard. * m2-lang.h: Add include guard. * location.h: Rename include guard. * linux-record.h: Rename include guard. * linux-nat.h: Add include guard. * linux-fork.h: Add include guard. * i386-darwin-tdep.h: Rename include guard. * hppa-linux-offsets.h: Add include guard. * guile/guile.h: Rename include guard. * guile/guile-internal.h: Rename include guard. * gnu-nat.h: Rename include guard. * gdb-stabs.h: Rename include guard. * frv-tdep.h: Add include guard. * f-lang.h: Add include guard. * event-loop.h: Add include guard. * darwin-nat.h: Rename include guard. * cp-abi.h: Rename include guard. * config/sparc/nm-sol2.h: Rename include guard. * config/nm-nto.h: Rename include guard. * config/nm-linux.h: Add include guard. * config/i386/nm-i386gnu.h: Rename include guard. * config/djgpp/nl_types.h: Rename include guard. * config/djgpp/langinfo.h: Rename include guard. * compile/gcc-cp-plugin.h: Add include guard. * compile/gcc-c-plugin.h: Add include guard. * compile/compile.h: Rename include guard. * compile/compile-object-run.h: Rename include guard. * compile/compile-object-load.h: Rename include guard. * compile/compile-internal.h: Rename include guard. * compile/compile-cplus.h: Rename include guard. * compile/compile-c.h: Rename include guard. * common/xml-utils.h: Rename include guard. * common/x86-xstate.h: Rename include guard. * common/version.h: Rename include guard. * common/vec.h: Rename include guard. * common/tdesc.h: Rename include guard. * common/selftest.h: Rename include guard. * common/scoped_restore.h: Rename include guard. * common/scoped_mmap.h: Rename include guard. * common/scoped_fd.h: Rename include guard. * common/safe-iterator.h: Rename include guard. * common/run-time-clock.h: Rename include guard. * common/refcounted-object.h: Rename include guard. * common/queue.h: Rename include guard. * common/ptid.h: Rename include guard. * common/print-utils.h: Rename include guard. * common/preprocessor.h: Rename include guard. * common/pathstuff.h: Rename include guard. * common/observable.h: Rename include guard. * common/netstuff.h: Rename include guard. * common/job-control.h: Rename include guard. * common/host-defs.h: Rename include guard. * common/gdb_wait.h: Rename include guard. * common/gdb_vecs.h: Rename include guard. * common/gdb_unlinker.h: Rename include guard. * common/gdb_unique_ptr.h: Rename include guard. * common/gdb_tilde_expand.h: Rename include guard. * common/gdb_sys_time.h: Rename include guard. * common/gdb_string_view.h: Rename include guard. * common/gdb_splay_tree.h: Rename include guard. * common/gdb_setjmp.h: Rename include guard. * common/gdb_ref_ptr.h: Rename include guard. * common/gdb_optional.h: Rename include guard. * common/gdb_locale.h: Rename include guard. * common/gdb_assert.h: Rename include guard. * common/filtered-iterator.h: Rename include guard. * common/filestuff.h: Rename include guard. * common/fileio.h: Rename include guard. * common/environ.h: Rename include guard. * common/common-utils.h: Rename include guard. * common/common-types.h: Rename include guard. * common/common-regcache.h: Rename include guard. * common/common-inferior.h: Rename include guard. * common/common-gdbthread.h: Rename include guard. * common/common-exceptions.h: Rename include guard. * common/common-defs.h: Rename include guard. * common/common-debug.h: Rename include guard. * common/cleanups.h: Rename include guard. * common/buffer.h: Rename include guard. * common/btrace-common.h: Rename include guard. * common/break-common.h: Rename include guard. * cli/cli-utils.h: Rename include guard. * cli/cli-style.h: Rename include guard. * cli/cli-setshow.h: Rename include guard. * cli/cli-script.h: Rename include guard. * cli/cli-interp.h: Rename include guard. * cli/cli-decode.h: Rename include guard. * cli/cli-cmds.h: Rename include guard. * charset-list.h: Add include guard. * buildsym-legacy.h: Rename include guard. * bfin-tdep.h: Add include guard. * ax.h: Rename include guard. * arm-linux-tdep.h: Add include guard. * arm-fbsd-tdep.h: Add include guard. * arch/xtensa.h: Rename include guard. * arch/tic6x.h: Add include guard. * arch/i386.h: Add include guard. * arch/arm.h: Rename include guard. * arch/arm-linux.h: Rename include guard. * arch/arm-get-next-pcs.h: Rename include guard. * arch/amd64.h: Add include guard. * arch/aarch64-insn.h: Rename include guard. * arch-utils.h: Rename include guard. * annotate.h: Add include guard. * amd64-darwin-tdep.h: Rename include guard. * aarch64-linux-tdep.h: Add include guard. * aarch64-fbsd-tdep.h: Add include guard. * aarch32-linux-nat.h: Add include guard. gdb/gdbserver/ChangeLog 2019-02-07 Tom Tromey <tom@tromey.com> * x86-tdesc.h: Rename include guard. * x86-low.h: Add include guard. * wincecompat.h: Rename include guard. * win32-low.h: Add include guard. * utils.h: Rename include guard. * tracepoint.h: Rename include guard. * tdesc.h: Rename include guard. * target.h: Rename include guard. * server.h: Rename include guard. * remote-utils.h: Rename include guard. * regcache.h: Rename include guard. * nto-low.h: Rename include guard. * notif.h: Add include guard. * mem-break.h: Rename include guard. * lynx-low.h: Add include guard. * linux-x86-tdesc.h: Add include guard. * linux-s390-tdesc.h: Add include guard. * linux-ppc-tdesc-init.h: Add include guard. * linux-low.h: Add include guard. * linux-aarch64-tdesc.h: Add include guard. * linux-aarch32-low.h: Add include guard. * inferiors.h: Rename include guard. * i387-fp.h: Rename include guard. * hostio.h: Rename include guard. * gdbthread.h: Rename include guard. * gdb_proc_service.h: Rename include guard. * event-loop.h: Rename include guard. * dll.h: Rename include guard. * debug.h: Rename include guard. * ax.h: Rename include guard.
257 lines
9.5 KiB
C++
257 lines
9.5 KiB
C++
/* Abstraction of various C++ ABI's we support, and the info we need
|
|
to get from them.
|
|
|
|
Contributed by Daniel Berlin <dberlin@redhat.com>
|
|
|
|
Copyright (C) 2001-2019 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 CP_ABI_H
|
|
#define CP_ABI_H
|
|
|
|
struct fn_field;
|
|
struct type;
|
|
struct value;
|
|
struct ui_file;
|
|
struct frame_info;
|
|
|
|
/* The functions here that attempt to determine what sort of thing a
|
|
mangled name refers to may well be revised in the future. It would
|
|
certainly be cleaner to carry this information explicitly in GDB's
|
|
data structures than to derive it from the mangled name. */
|
|
|
|
|
|
/* Kinds of constructors. All these values are guaranteed to be
|
|
non-zero. */
|
|
enum ctor_kinds {
|
|
|
|
/* Initialize a complete object, including virtual bases, using
|
|
memory provided by caller. */
|
|
complete_object_ctor = 1,
|
|
|
|
/* Initialize a base object of some larger object. */
|
|
base_object_ctor,
|
|
|
|
/* An allocating complete-object constructor. */
|
|
complete_object_allocating_ctor
|
|
};
|
|
|
|
/* Return non-zero iff NAME is the mangled name of a constructor.
|
|
Actually, return an `enum ctor_kind' value describing what *kind*
|
|
of constructor it is. */
|
|
extern enum ctor_kinds is_constructor_name (const char *name);
|
|
|
|
|
|
/* Kinds of destructors. All these values are guaranteed to be
|
|
non-zero. */
|
|
enum dtor_kinds {
|
|
|
|
/* A destructor which finalizes the entire object, and then calls
|
|
`delete' on its storage. */
|
|
deleting_dtor = 1,
|
|
|
|
/* A destructor which finalizes the entire object, but does not call
|
|
`delete'. */
|
|
complete_object_dtor,
|
|
|
|
/* A destructor which finalizes a subobject of some larger
|
|
object. */
|
|
base_object_dtor
|
|
};
|
|
|
|
/* Return non-zero iff NAME is the mangled name of a destructor.
|
|
Actually, return an `enum dtor_kind' value describing what *kind*
|
|
of destructor it is. */
|
|
extern enum dtor_kinds is_destructor_name (const char *name);
|
|
|
|
|
|
/* Return non-zero iff NAME is the mangled name of a vtable. */
|
|
extern int is_vtable_name (const char *name);
|
|
|
|
|
|
/* Return non-zero iff NAME is the un-mangled name of an operator,
|
|
perhaps scoped within some class. */
|
|
extern int is_operator_name (const char *name);
|
|
|
|
|
|
/* Return an object's virtual function as a value.
|
|
|
|
VALUEP is a pointer to a pointer to a value, holding the object
|
|
whose virtual function we want to invoke. If the ABI requires a
|
|
virtual function's caller to adjust the `this' pointer by an amount
|
|
retrieved from the vtable before invoking the function (i.e., we're
|
|
not using "vtable thunks" to do the adjustment automatically), then
|
|
this function may set *VALUEP to point to a new object with an
|
|
appropriately tweaked address.
|
|
|
|
The J'th element of the overload set F is the virtual function of
|
|
*VALUEP we want to invoke.
|
|
|
|
TYPE is the base type of *VALUEP whose method we're invoking ---
|
|
this is the type containing F. OFFSET is the offset of that base
|
|
type within *VALUEP. */
|
|
extern struct value *value_virtual_fn_field (struct value **valuep,
|
|
struct fn_field *f,
|
|
int j,
|
|
struct type *type,
|
|
int offset);
|
|
|
|
|
|
/* Try to find the run-time type of VALUE, using C++ run-time type
|
|
information. Return the run-time type, or zero if we can't figure
|
|
it out.
|
|
|
|
If we do find the run-time type:
|
|
- Set *FULL to non-zero if VALUE already contains the complete
|
|
run-time object, not just some embedded base class of the object.
|
|
- Set *TOP and *USING_ENC to indicate where the enclosing object
|
|
starts relative to VALUE:
|
|
- If *USING_ENC is zero, then *TOP is the offset from the start
|
|
of the complete object to the start of the embedded subobject
|
|
VALUE represents. In other words, the enclosing object starts
|
|
at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
|
|
value_embedded_offset (VALUE) + *TOP
|
|
- If *USING_ENC is non-zero, then *TOP is the offset from the
|
|
address of the complete object to the enclosing object stored
|
|
in VALUE. In other words, the enclosing object starts at
|
|
VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) + *TOP.
|
|
If VALUE's type and enclosing type are the same, then these two
|
|
cases are equivalent.
|
|
|
|
FULL, TOP, and USING_ENC can each be zero, in which case we don't
|
|
provide the corresponding piece of information. */
|
|
extern struct type *value_rtti_type (struct value *value,
|
|
int *full, LONGEST *top,
|
|
int *using_enc);
|
|
|
|
/* Compute the offset of the baseclass which is the INDEXth baseclass
|
|
of class TYPE, for value at VALADDR (in host) at ADDRESS (in
|
|
target), offset by EMBEDDED_OFFSET. VALADDR points to the raw
|
|
contents of VAL. The result is the offset of the baseclass value
|
|
relative to (the address of)(ARG) + OFFSET. */
|
|
|
|
extern int baseclass_offset (struct type *type,
|
|
int index, const gdb_byte *valaddr,
|
|
LONGEST embedded_offset,
|
|
CORE_ADDR address,
|
|
const struct value *val);
|
|
|
|
/* Describe the target of a pointer to method. CONTENTS is the byte
|
|
pattern representing the pointer to method. TYPE is the pointer to
|
|
method type. STREAM is the stream to print it to. */
|
|
void cplus_print_method_ptr (const gdb_byte *contents,
|
|
struct type *type,
|
|
struct ui_file *stream);
|
|
|
|
/* Return the size of a pointer to member function of type
|
|
TO_TYPE. */
|
|
int cplus_method_ptr_size (struct type *to_type);
|
|
|
|
/* Return the method which should be called by applying METHOD_PTR to
|
|
*THIS_P, and adjust *THIS_P if necessary. */
|
|
struct value *cplus_method_ptr_to_value (struct value **this_p,
|
|
struct value *method_ptr);
|
|
|
|
/* Create the byte pattern in CONTENTS representing a pointer of type
|
|
TYPE to member function at ADDRESS (if IS_VIRTUAL is 0) or with
|
|
virtual table offset ADDRESS (if IS_VIRTUAL is 1). This is the
|
|
opposite of cplus_method_ptr_to_value. */
|
|
void cplus_make_method_ptr (struct type *type, gdb_byte *CONTENTS,
|
|
CORE_ADDR address, int is_virtual);
|
|
|
|
/* Print the vtable for VALUE, if there is one. If there is no
|
|
vtable, print a message, but do not throw. */
|
|
|
|
void cplus_print_vtable (struct value *value);
|
|
|
|
/* Implement 'typeid': find the type info for VALUE, if possible. If
|
|
the type info cannot be found, throw an exception. */
|
|
|
|
extern struct value *cplus_typeid (struct value *value);
|
|
|
|
/* Return the type of 'typeid' for the current C++ ABI on the given
|
|
architecture. */
|
|
|
|
extern struct type *cplus_typeid_type (struct gdbarch *gdbarch);
|
|
|
|
/* Given a value which holds a pointer to a std::type_info, return the
|
|
type which that type_info represents. Throw an exception if the
|
|
type cannot be found. */
|
|
|
|
extern struct type *cplus_type_from_type_info (struct value *value);
|
|
|
|
/* Given a value which holds a pointer to a std::type_info, return the
|
|
name of the type which that type_info represents. Throw an
|
|
exception if the type name cannot be found. */
|
|
|
|
extern std::string cplus_typename_from_type_info (struct value *value);
|
|
|
|
/* Determine if we are currently in a C++ thunk. If so, get the
|
|
address of the routine we are thunking to and continue to there
|
|
instead. */
|
|
|
|
CORE_ADDR cplus_skip_trampoline (struct frame_info *frame,
|
|
CORE_ADDR stop_pc);
|
|
|
|
/* Return non-zero if an argument of type TYPE should be passed by
|
|
reference instead of value. */
|
|
extern int cp_pass_by_reference (struct type *type);
|
|
|
|
struct cp_abi_ops
|
|
{
|
|
const char *shortname;
|
|
const char *longname;
|
|
const char *doc;
|
|
|
|
/* ABI-specific implementations for the functions declared
|
|
above. */
|
|
enum ctor_kinds (*is_constructor_name) (const char *name);
|
|
enum dtor_kinds (*is_destructor_name) (const char *name);
|
|
int (*is_vtable_name) (const char *name);
|
|
int (*is_operator_name) (const char *name);
|
|
struct value *(*virtual_fn_field) (struct value **arg1p,
|
|
struct fn_field * f,
|
|
int j, struct type * type,
|
|
int offset);
|
|
struct type *(*rtti_type) (struct value *v, int *full,
|
|
LONGEST *top, int *using_enc);
|
|
int (*baseclass_offset) (struct type *type, int index,
|
|
const bfd_byte *valaddr, LONGEST embedded_offset,
|
|
CORE_ADDR address, const struct value *val);
|
|
void (*print_method_ptr) (const gdb_byte *contents,
|
|
struct type *type,
|
|
struct ui_file *stream);
|
|
int (*method_ptr_size) (struct type *);
|
|
void (*make_method_ptr) (struct type *, gdb_byte *,
|
|
CORE_ADDR, int);
|
|
struct value * (*method_ptr_to_value) (struct value **,
|
|
struct value *);
|
|
void (*print_vtable) (struct value *);
|
|
struct value *(*get_typeid) (struct value *value);
|
|
struct type *(*get_typeid_type) (struct gdbarch *gdbarch);
|
|
struct type *(*get_type_from_type_info) (struct value *value);
|
|
std::string (*get_typename_from_type_info) (struct value *value);
|
|
CORE_ADDR (*skip_trampoline) (struct frame_info *, CORE_ADDR);
|
|
int (*pass_by_reference) (struct type *type);
|
|
};
|
|
|
|
|
|
extern int register_cp_abi (struct cp_abi_ops *abi);
|
|
extern void set_cp_abi_as_auto_default (const char *short_name);
|
|
|
|
#endif /* CP_ABI_H */
|