Fix redefinition errors in C++ mode

In C, we can forward declare static structure instances.  That doesn't
work in C++ though.  C++ treats these as definitions.  So then the
compiler complains about symbol redefinition, like:

 src/gdb/elfread.c:1569:29: error: redefinition of ‘const sym_fns elf_sym_fns_lazy_psyms’
 src/gdb/elfread.c:53:29: error: ‘const sym_fns elf_sym_fns_lazy_psyms’ previously declared here

The intent of static here is naturally to avoid making these objects
visible outside the compilation unit.  The equivalent in C++ would be
to instead define the objects in the anonymous namespace.  But given
that it's desirable to leave the codebase compiling as both C and C++
for a while, this just makes the objects extern.

(base_breakpoint_ops is already declared in breakpoint.h, so we can
just remove the forward declare from breakpoint.c)

gdb/ChangeLog:
2015-02-11  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves <palves@redhat.com>

	* breakpoint.c (base_breakpoint_ops): Delete.
	* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
	* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
	* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
	* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
	* python/py-arch.c (arch_object_type): Make extern.
	* python/py-block.c (block_syms_iterator_object_type): Make extern.
	* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
	* python/py-cmd.c (cmdpy_object_type): Make extern.
	* python/py-continueevent.c (continue_event_object_type)
	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
	parameter.  Update all callers.
	* python/py-evtregistry.c (eventregistry_object_type): Make extern.
	* python/py-exitedevent.c (exited_event_object_type): Make extern.
	* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
	* python/py-function.c (fnpy_object_type): Make extern.
	* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
	* python/py-infevents.c (call_pre_event_object_type)
	(inferior_call_post_event_object_type).
	(memory_changed_event_object_type): Make extern.
	* python/py-infthread.c (thread_object_type): Make extern.
	* python/py-lazy-string.c (lazy_string_object_type): Make extern.
	* python/py-linetable.c (linetable_entry_object_type)
	(linetable_object_type, ltpy_iterator_object_type): Make extern.
	* python/py-newobjfileevent.c (new_objfile_event_object_type)
	(clear_objfiles_event_object_type): Make extern.
	* python/py-objfile.c (objfile_object_type): Make extern.
	* python/py-param.c (parmpy_object_type): Make extern.
	* python/py-progspace.c (pspace_object_type): Make extern.
	* python/py-signalevent.c (signal_event_object_type): Make extern.
	* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
	* python/py-type.c (type_object_type, field_object_type)
	(type_iterator_object_type): Make extern.
	* python/python.c (python_extension_script_ops)
	(python_extension_ops): Make extern.
	* stap-probe.c (stap_probe_ops): Make extern.
This commit is contained in:
Tom Tromey 2015-02-11 11:20:21 +00:00 committed by Pedro Alves
parent b19f47add0
commit e36122e9d7
32 changed files with 124 additions and 101 deletions

View File

@ -1,3 +1,43 @@
2015-02-11 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
* breakpoint.c (base_breakpoint_ops): Delete.
* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
* python/py-arch.c (arch_object_type): Make extern.
* python/py-block.c (block_syms_iterator_object_type): Make extern.
* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
* python/py-cmd.c (cmdpy_object_type): Make extern.
* python/py-continueevent.c (continue_event_object_type)
* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
parameter. Update all callers.
* python/py-evtregistry.c (eventregistry_object_type): Make extern.
* python/py-exitedevent.c (exited_event_object_type): Make extern.
* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
* python/py-function.c (fnpy_object_type): Make extern.
* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
* python/py-infevents.c (call_pre_event_object_type)
(inferior_call_post_event_object_type).
(memory_changed_event_object_type): Make extern.
* python/py-infthread.c (thread_object_type): Make extern.
* python/py-lazy-string.c (lazy_string_object_type): Make extern.
* python/py-linetable.c (linetable_entry_object_type)
(linetable_object_type, ltpy_iterator_object_type): Make extern.
* python/py-newobjfileevent.c (new_objfile_event_object_type)
(clear_objfiles_event_object_type): Make extern.
* python/py-objfile.c (objfile_object_type): Make extern.
* python/py-param.c (parmpy_object_type): Make extern.
* python/py-progspace.c (pspace_object_type): Make extern.
* python/py-signalevent.c (signal_event_object_type): Make extern.
* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
* python/py-type.c (type_object_type, field_object_type)
(type_iterator_object_type): Make extern.
* python/python.c (python_extension_script_ops)
(python_extension_ops): Make extern.
* stap-probe.c (stap_probe_ops): Make extern.
2015-02-11 Pedro Alves <pedro@codesourcery.com> 2015-02-11 Pedro Alves <pedro@codesourcery.com>
* infrun.c (adjust_pc_after_break): Don't adjust the PC just * infrun.c (adjust_pc_after_break): Don't adjust the PC just

View File

@ -297,10 +297,6 @@ static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address);
static int strace_marker_p (struct breakpoint *b); static int strace_marker_p (struct breakpoint *b);
/* The abstract base class all breakpoint_ops structures inherit
from. */
struct breakpoint_ops base_breakpoint_ops;
/* The breakpoint_ops structure to be inherited by all breakpoint_ops /* The breakpoint_ops structure to be inherited by all breakpoint_ops
that are implemented on top of software or hardware breakpoints that are implemented on top of software or hardware breakpoints
(user breakpoints, internal and momentary breakpoints, etc.). */ (user breakpoints, internal and momentary breakpoints, etc.). */

View File

@ -41,7 +41,7 @@
extern int dwarf2_always_disassemble; extern int dwarf2_always_disassemble;
static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs; extern const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs;
static struct value *dwarf2_evaluate_loc_desc_full (struct type *type, static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
struct frame_info *frame, struct frame_info *frame,
@ -2151,7 +2151,7 @@ static const struct lval_funcs pieced_value_funcs = {
/* Virtual method table for dwarf2_evaluate_loc_desc_full below. */ /* Virtual method table for dwarf2_evaluate_loc_desc_full below. */
static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs = const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
{ {
dwarf_expr_read_addr_from_reg, dwarf_expr_read_addr_from_reg,
dwarf_expr_get_reg_value, dwarf_expr_get_reg_value,

View File

@ -49,8 +49,8 @@
extern void _initialize_elfread (void); extern void _initialize_elfread (void);
/* Forward declarations. */ /* Forward declarations. */
static const struct sym_fns elf_sym_fns_gdb_index; extern const struct sym_fns elf_sym_fns_gdb_index;
static const struct sym_fns elf_sym_fns_lazy_psyms; extern const struct sym_fns elf_sym_fns_lazy_psyms;
/* The struct elfinfo is available only during ELF symbol table and /* The struct elfinfo is available only during ELF symbol table and
psymtab reading. It is destroyed at the completion of psymtab-reading. psymtab reading. It is destroyed at the completion of psymtab-reading.
@ -1566,7 +1566,7 @@ static const struct sym_fns elf_sym_fns =
/* The same as elf_sym_fns, but not registered and lazily reads /* The same as elf_sym_fns, but not registered and lazily reads
psymbols. */ psymbols. */
static const struct sym_fns elf_sym_fns_lazy_psyms = const struct sym_fns elf_sym_fns_lazy_psyms =
{ {
elf_new_init, /* init anything gbl to entire symtab */ elf_new_init, /* init anything gbl to entire symtab */
elf_symfile_init, /* read initial info, setup for sym_read() */ elf_symfile_init, /* read initial info, setup for sym_read() */
@ -1583,7 +1583,7 @@ static const struct sym_fns elf_sym_fns_lazy_psyms =
/* The same as elf_sym_fns, but not registered and uses the /* The same as elf_sym_fns, but not registered and uses the
DWARF-specific GNU index rather than psymtab. */ DWARF-specific GNU index rather than psymtab. */
static const struct sym_fns elf_sym_fns_gdb_index = const struct sym_fns elf_sym_fns_gdb_index =
{ {
elf_new_init, /* init anything gbl to entire symab */ elf_new_init, /* init anything gbl to entire symab */
elf_symfile_init, /* read initial info, setup for sym_red() */ elf_symfile_init, /* read initial info, setup for sym_red() */

View File

@ -71,8 +71,8 @@ const char *gdbscm_print_excp = gdbscm_print_excp_message;
#ifdef HAVE_GUILE #ifdef HAVE_GUILE
/* Forward decls, these are defined later. */ /* Forward decls, these are defined later. */
static const struct extension_language_script_ops guile_extension_script_ops; extern const struct extension_language_script_ops guile_extension_script_ops;
static const struct extension_language_ops guile_extension_ops; extern const struct extension_language_ops guile_extension_ops;
#endif #endif
/* The main struct describing GDB's interface to the Guile /* The main struct describing GDB's interface to the Guile
@ -124,7 +124,7 @@ static const char boot_scm_filename[] = "boot.scm";
/* The interface between gdb proper and loading of python scripts. */ /* The interface between gdb proper and loading of python scripts. */
static const struct extension_language_script_ops guile_extension_script_ops = const struct extension_language_script_ops guile_extension_script_ops =
{ {
gdbscm_source_script, gdbscm_source_script,
gdbscm_source_objfile_script, gdbscm_source_objfile_script,
@ -134,7 +134,7 @@ static const struct extension_language_script_ops guile_extension_script_ops =
/* The interface between gdb proper and guile scripting. */ /* The interface between gdb proper and guile scripting. */
static const struct extension_language_ops guile_extension_ops = const struct extension_language_ops guile_extension_ops =
{ {
gdbscm_finish_initialization, gdbscm_finish_initialization,
gdbscm_initialized, gdbscm_initialized,

View File

@ -92,7 +92,7 @@ ppcnbsd_return_value (struct gdbarch *gdbarch, struct value *function,
/* Signal trampolines. */ /* Signal trampolines. */
static const struct tramp_frame ppcnbsd2_sigtramp; extern const struct tramp_frame ppcnbsd2_sigtramp;
static void static void
ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self, ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
@ -151,7 +151,7 @@ static const struct tramp_frame ppcnbsd_sigtramp =
/* NetBSD 2.0 introduced a slightly different signal trampoline. */ /* NetBSD 2.0 introduced a slightly different signal trampoline. */
static const struct tramp_frame ppcnbsd2_sigtramp = const struct tramp_frame ppcnbsd2_sigtramp =
{ {
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
4, 4,

View File

@ -42,7 +42,7 @@ static struct gdbarch_data *arch_object_data = NULL;
} \ } \
} while (0) } while (0)
static PyTypeObject arch_object_type extern PyTypeObject arch_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object");
/* Associates an arch_object with GDBARCH as gdbarch_data via the gdbarch /* Associates an arch_object with GDBARCH as gdbarch_data via the gdbarch
@ -281,7 +281,7 @@ END_PC." },
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
static PyTypeObject arch_object_type = { PyTypeObject arch_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Architecture", /* tp_name */ "gdb.Architecture", /* tp_name */
sizeof (arch_object), /* tp_basicsize */ sizeof (arch_object), /* tp_basicsize */

View File

@ -78,7 +78,7 @@ typedef struct {
} \ } \
} while (0) } while (0)
static PyTypeObject block_syms_iterator_object_type extern PyTypeObject block_syms_iterator_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
static const struct objfile_data *blpy_objfile_data_key; static const struct objfile_data *blpy_objfile_data_key;
@ -515,7 +515,7 @@ Return true if this block iterator is valid, false if not." },
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
static PyTypeObject block_syms_iterator_object_type = { PyTypeObject block_syms_iterator_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.BlockIterator", /*tp_name*/ "gdb.BlockIterator", /*tp_name*/
sizeof (block_syms_iterator_object), /*tp_basicsize*/ sizeof (block_syms_iterator_object), /*tp_basicsize*/

View File

@ -20,7 +20,7 @@
#include "defs.h" #include "defs.h"
#include "py-stopevent.h" #include "py-stopevent.h"
static PyTypeObject breakpoint_event_object_type extern PyTypeObject breakpoint_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
/* Create and initialize a BreakpointEvent object. This acquires new /* Create and initialize a BreakpointEvent object. This acquires new
@ -55,5 +55,4 @@ GDBPY_NEW_EVENT_TYPE (breakpoint,
"gdb.BreakpointEvent", "gdb.BreakpointEvent",
"BreakpointEvent", "BreakpointEvent",
"GDB breakpoint stop event object", "GDB breakpoint stop event object",
stop_event_object_type, stop_event_object_type);
static);

View File

@ -70,7 +70,7 @@ struct cmdpy_object
typedef struct cmdpy_object cmdpy_object; typedef struct cmdpy_object cmdpy_object;
static PyTypeObject cmdpy_object_type extern PyTypeObject cmdpy_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object");
/* Constants used by this module. */ /* Constants used by this module. */
@ -746,7 +746,7 @@ static PyMethodDef cmdpy_object_methods[] =
{ 0 } { 0 }
}; };
static PyTypeObject cmdpy_object_type = PyTypeObject cmdpy_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Command", /*tp_name*/ "gdb.Command", /*tp_name*/

View File

@ -20,7 +20,7 @@
#include "defs.h" #include "defs.h"
#include "py-event.h" #include "py-event.h"
static PyTypeObject continue_event_object_type extern PyTypeObject continue_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
static PyObject * static PyObject *
@ -51,5 +51,4 @@ GDBPY_NEW_EVENT_TYPE (continue,
"gdb.ContinueEvent", "gdb.ContinueEvent",
"ContinueEvent", "ContinueEvent",
"GDB continue event object", "GDB continue event object",
thread_event_object_type, thread_event_object_type);
static);

View File

@ -41,12 +41,11 @@
python. python.
DOC Python documentation for the new event type DOC Python documentation for the new event type
BASE the base event for this event usually just event_object_type. BASE the base event for this event usually just event_object_type.
QUAL qualification for the create event usually 'static'
*/ */
#define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base, qual) \ #define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base) \
\ \
qual PyTypeObject name##_event_object_type \ PyTypeObject name##_event_object_type \
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \
= { \ = { \
PyVarObject_HEAD_INIT (NULL, 0) \ PyVarObject_HEAD_INIT (NULL, 0) \

View File

@ -23,7 +23,7 @@
events_object gdb_py_events; events_object gdb_py_events;
static PyTypeObject eventregistry_object_type extern PyTypeObject eventregistry_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("eventregistry_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("eventregistry_object");
/* Implementation of EventRegistry.connect () -> NULL. /* Implementation of EventRegistry.connect () -> NULL.
@ -132,7 +132,7 @@ static PyMethodDef eventregistry_object_methods[] =
{ NULL } /* Sentinel. */ { NULL } /* Sentinel. */
}; };
static PyTypeObject eventregistry_object_type = PyTypeObject eventregistry_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.EventRegistry", /* tp_name */ "gdb.EventRegistry", /* tp_name */

View File

@ -20,7 +20,7 @@
#include "defs.h" #include "defs.h"
#include "py-event.h" #include "py-event.h"
static PyTypeObject exited_event_object_type extern PyTypeObject exited_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
static PyObject * static PyObject *
@ -88,5 +88,4 @@ GDBPY_NEW_EVENT_TYPE (exited,
"gdb.ExitedEvent", "gdb.ExitedEvent",
"ExitedEvent", "ExitedEvent",
"GDB exited event object", "GDB exited event object",
event_object_type, event_object_type);
static);

View File

@ -52,7 +52,7 @@ struct finish_breakpoint_object
PyObject *return_value; PyObject *return_value;
}; };
static PyTypeObject finish_breakpoint_object_type extern PyTypeObject finish_breakpoint_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("finish_breakpoint_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("finish_breakpoint_object");
/* Python function to get the 'return_value' attribute of /* Python function to get the 'return_value' attribute of
@ -429,7 +429,7 @@ None otherwise.", NULL },
{ NULL } /* Sentinel. */ { NULL } /* Sentinel. */
}; };
static PyTypeObject finish_breakpoint_object_type = PyTypeObject finish_breakpoint_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.FinishBreakpoint", /*tp_name*/ "gdb.FinishBreakpoint", /*tp_name*/

View File

@ -28,7 +28,7 @@
#include "expression.h" #include "expression.h"
#include "language.h" #include "language.h"
static PyTypeObject fnpy_object_type extern PyTypeObject fnpy_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject");
@ -212,7 +212,7 @@ gdbpy_initialize_functions (void)
static PyTypeObject fnpy_object_type = PyTypeObject fnpy_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Function", /*tp_name*/ "gdb.Function", /*tp_name*/

View File

@ -50,7 +50,7 @@ typedef struct
int nthreads; int nthreads;
} inferior_object; } inferior_object;
static PyTypeObject inferior_object_type extern PyTypeObject inferior_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object");
static const struct inferior_data *infpy_inf_data_key; static const struct inferior_data *infpy_inf_data_key;
@ -64,7 +64,7 @@ typedef struct {
CORE_ADDR length; CORE_ADDR length;
} membuf_object; } membuf_object;
static PyTypeObject membuf_object_type extern PyTypeObject membuf_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object");
/* Require that INFERIOR be a valid inferior ID. */ /* Require that INFERIOR be a valid inferior ID. */
@ -915,7 +915,7 @@ Return a long with the address of a match, or None." },
{ NULL } { NULL }
}; };
static PyTypeObject inferior_object_type = PyTypeObject inferior_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Inferior", /* tp_name */ "gdb.Inferior", /* tp_name */
@ -982,7 +982,7 @@ static PyBufferProcs buffer_procs = {
}; };
#endif /* IS_PY3K */ #endif /* IS_PY3K */
static PyTypeObject membuf_object_type = { PyTypeObject membuf_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Membuf", /*tp_name*/ "gdb.Membuf", /*tp_name*/
sizeof (membuf_object), /*tp_basicsize*/ sizeof (membuf_object), /*tp_basicsize*/

View File

@ -20,13 +20,13 @@
#include "defs.h" #include "defs.h"
#include "py-event.h" #include "py-event.h"
static PyTypeObject inferior_call_pre_event_object_type extern PyTypeObject inferior_call_pre_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
static PyTypeObject inferior_call_post_event_object_type extern PyTypeObject inferior_call_post_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
static PyTypeObject register_changed_event_object_type extern PyTypeObject register_changed_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
static PyTypeObject memory_changed_event_object_type extern PyTypeObject memory_changed_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
/* Construct either a gdb.InferiorCallPreEvent or a /* Construct either a gdb.InferiorCallPreEvent or a
@ -238,26 +238,22 @@ GDBPY_NEW_EVENT_TYPE (inferior_call_pre,
"gdb.InferiorCallPreEvent", "gdb.InferiorCallPreEvent",
"InferiorCallPreEvent", "InferiorCallPreEvent",
"GDB inferior function pre-call event object", "GDB inferior function pre-call event object",
event_object_type, event_object_type);
static);
GDBPY_NEW_EVENT_TYPE (inferior_call_post, GDBPY_NEW_EVENT_TYPE (inferior_call_post,
"gdb.InferiorCallPostEvent", "gdb.InferiorCallPostEvent",
"InferiorCallPostEvent", "InferiorCallPostEvent",
"GDB inferior function post-call event object", "GDB inferior function post-call event object",
event_object_type, event_object_type);
static);
GDBPY_NEW_EVENT_TYPE (register_changed, GDBPY_NEW_EVENT_TYPE (register_changed,
"gdb.RegisterChangedEvent", "gdb.RegisterChangedEvent",
"RegisterChangedEvent", "RegisterChangedEvent",
"GDB register change event object", "GDB register change event object",
event_object_type, event_object_type);
static);
GDBPY_NEW_EVENT_TYPE (memory_changed, GDBPY_NEW_EVENT_TYPE (memory_changed,
"gdb.MemoryChangedEvent", "gdb.MemoryChangedEvent",
"MemoryChangedEvent", "MemoryChangedEvent",
"GDB memory change event object", "GDB memory change event object",
event_object_type, event_object_type);
static);

View File

@ -22,7 +22,7 @@
#include "inferior.h" #include "inferior.h"
#include "python-internal.h" #include "python-internal.h"
static PyTypeObject thread_object_type extern PyTypeObject thread_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
/* Require that INFERIOR be a valid inferior ID. */ /* Require that INFERIOR be a valid inferior ID. */
@ -307,7 +307,7 @@ Return whether the thread is exited." },
{ NULL } { NULL }
}; };
static PyTypeObject thread_object_type = PyTypeObject thread_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.InferiorThread", /*tp_name*/ "gdb.InferiorThread", /*tp_name*/

View File

@ -45,7 +45,7 @@ typedef struct {
struct type *type; struct type *type;
} lazy_string_object; } lazy_string_object;
static PyTypeObject lazy_string_object_type extern PyTypeObject lazy_string_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("lazy_string_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("lazy_string_object");
static PyObject * static PyObject *
@ -215,7 +215,7 @@ static PyGetSetDef lazy_string_object_getset[] = {
{ NULL } /* Sentinel */ { NULL } /* Sentinel */
}; };
static PyTypeObject lazy_string_object_type = { PyTypeObject lazy_string_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.LazyString", /*tp_name*/ "gdb.LazyString", /*tp_name*/
sizeof (lazy_string_object), /*tp_basicsize*/ sizeof (lazy_string_object), /*tp_basicsize*/

View File

@ -28,7 +28,7 @@ typedef struct {
CORE_ADDR pc; CORE_ADDR pc;
} linetable_entry_object; } linetable_entry_object;
static PyTypeObject linetable_entry_object_type extern PyTypeObject linetable_entry_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object");
typedef struct { typedef struct {
@ -39,7 +39,7 @@ typedef struct {
PyObject *symtab; PyObject *symtab;
} linetable_object; } linetable_object;
static PyTypeObject linetable_object_type extern PyTypeObject linetable_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object");
typedef struct { typedef struct {
@ -52,7 +52,7 @@ typedef struct {
PyObject *source; PyObject *source;
} ltpy_iterator_object; } ltpy_iterator_object;
static PyTypeObject ltpy_iterator_object_type extern PyTypeObject ltpy_iterator_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object");
/* Internal helper function to extract gdb.Symtab from a gdb.Linetable /* Internal helper function to extract gdb.Symtab from a gdb.Linetable
@ -493,7 +493,7 @@ Return True if this Linetable is valid, False if not." },
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
static PyTypeObject linetable_object_type = { PyTypeObject linetable_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.LineTable", /*tp_name*/ "gdb.LineTable", /*tp_name*/
sizeof (linetable_object), /*tp_basicsize*/ sizeof (linetable_object), /*tp_basicsize*/
@ -540,7 +540,7 @@ Return True if this Linetable iterator is valid, False if not." },
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
static PyTypeObject ltpy_iterator_object_type = { PyTypeObject ltpy_iterator_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.LineTableIterator", /*tp_name*/ "gdb.LineTableIterator", /*tp_name*/
sizeof (ltpy_iterator_object), /*tp_basicsize*/ sizeof (ltpy_iterator_object), /*tp_basicsize*/
@ -580,7 +580,7 @@ static PyGetSetDef linetable_entry_object_getset[] = {
{ NULL } /* Sentinel */ { NULL } /* Sentinel */
}; };
static PyTypeObject linetable_entry_object_type = { PyTypeObject linetable_entry_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.LineTableEntry", /*tp_name*/ "gdb.LineTableEntry", /*tp_name*/
sizeof (linetable_entry_object), /*tp_basicsize*/ sizeof (linetable_entry_object), /*tp_basicsize*/

View File

@ -20,9 +20,9 @@
#include "defs.h" #include "defs.h"
#include "py-event.h" #include "py-event.h"
static PyTypeObject new_objfile_event_object_type extern PyTypeObject new_objfile_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
static PyTypeObject clear_objfiles_event_object_type extern PyTypeObject clear_objfiles_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
static PyObject * static PyObject *
@ -72,8 +72,7 @@ GDBPY_NEW_EVENT_TYPE (new_objfile,
"gdb.NewObjFileEvent", "gdb.NewObjFileEvent",
"NewObjFileEvent", "NewObjFileEvent",
"GDB new object file event object", "GDB new object file event object",
event_object_type, event_object_type);
static);
/* Subroutine of emit_clear_objfiles_event to simplify it. */ /* Subroutine of emit_clear_objfiles_event to simplify it. */
@ -125,5 +124,4 @@ GDBPY_NEW_EVENT_TYPE (clear_objfiles,
"gdb.ClearObjFilesEvent", "gdb.ClearObjFilesEvent",
"ClearObjFilesEvent", "ClearObjFilesEvent",
"GDB clear object files event object", "GDB clear object files event object",
event_object_type, event_object_type);
static);

View File

@ -49,7 +49,7 @@ typedef struct
PyObject *xmethods; PyObject *xmethods;
} objfile_object; } objfile_object;
static PyTypeObject objfile_object_type extern PyTypeObject objfile_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object");
static const struct objfile_data *objfpy_objfile_data_key; static const struct objfile_data *objfpy_objfile_data_key;
@ -652,7 +652,7 @@ static PyGetSetDef objfile_getset[] =
{ NULL } { NULL }
}; };
static PyTypeObject objfile_object_type = PyTypeObject objfile_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Objfile", /*tp_name*/ "gdb.Objfile", /*tp_name*/

View File

@ -88,7 +88,7 @@ struct parmpy_object
typedef struct parmpy_object parmpy_object; typedef struct parmpy_object parmpy_object;
static PyTypeObject parmpy_object_type extern PyTypeObject parmpy_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object");
/* Some handy string constants. */ /* Some handy string constants. */
@ -779,7 +779,7 @@ gdbpy_initialize_parameters (void)
static PyTypeObject parmpy_object_type = PyTypeObject parmpy_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Parameter", /*tp_name*/ "gdb.Parameter", /*tp_name*/

View File

@ -48,7 +48,7 @@ typedef struct
PyObject *xmethods; PyObject *xmethods;
} pspace_object; } pspace_object;
static PyTypeObject pspace_object_type extern PyTypeObject pspace_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object");
static const struct program_space_data *pspy_pspace_data_key; static const struct program_space_data *pspy_pspace_data_key;
@ -352,7 +352,7 @@ static PyGetSetDef pspace_getset[] =
{ NULL } { NULL }
}; };
static PyTypeObject pspace_object_type = PyTypeObject pspace_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Progspace", /*tp_name*/ "gdb.Progspace", /*tp_name*/

View File

@ -20,7 +20,7 @@
#include "defs.h" #include "defs.h"
#include "py-stopevent.h" #include "py-stopevent.h"
static PyTypeObject signal_event_object_type extern PyTypeObject signal_event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
PyObject * PyObject *
@ -57,5 +57,4 @@ GDBPY_NEW_EVENT_TYPE (signal,
"gdb.SignalEvent", "gdb.SignalEvent",
"SignalEvent", "SignalEvent",
"GDB signal event object", "GDB signal event object",
stop_event_object_type, stop_event_object_type);
static);

View File

@ -115,5 +115,4 @@ GDBPY_NEW_EVENT_TYPE (stop,
"gdb.StopEvent", "gdb.StopEvent",
"StopEvent", "StopEvent",
"GDB stop event object", "GDB stop event object",
thread_event_object_type, thread_event_object_type);
/*no qual*/);

View File

@ -37,7 +37,7 @@ typedef struct stpy_symtab_object {
struct stpy_symtab_object *next; struct stpy_symtab_object *next;
} symtab_object; } symtab_object;
static PyTypeObject symtab_object_type extern PyTypeObject symtab_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object");
static const struct objfile_data *stpy_objfile_data_key; static const struct objfile_data *stpy_objfile_data_key;
@ -68,7 +68,7 @@ typedef struct salpy_sal_object {
struct salpy_sal_object *next; struct salpy_sal_object *next;
} sal_object; } sal_object;
static PyTypeObject sal_object_type extern PyTypeObject sal_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object");
static const struct objfile_data *salpy_objfile_data_key; static const struct objfile_data *salpy_objfile_data_key;
@ -576,7 +576,7 @@ Return the Linetable associated with this symbol table" },
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
static PyTypeObject symtab_object_type = { PyTypeObject symtab_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Symtab", /*tp_name*/ "gdb.Symtab", /*tp_name*/
sizeof (symtab_object), /*tp_basicsize*/ sizeof (symtab_object), /*tp_basicsize*/
@ -626,7 +626,7 @@ Return true if this symbol table and line is valid, false if not." },
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
static PyTypeObject sal_object_type = { PyTypeObject sal_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Symtab_and_line", /*tp_name*/ "gdb.Symtab_and_line", /*tp_name*/
sizeof (sal_object), /*tp_basicsize*/ sizeof (sal_object), /*tp_basicsize*/

View File

@ -77,5 +77,4 @@ GDBPY_NEW_EVENT_TYPE (thread,
"gdb.ThreadEvent", "gdb.ThreadEvent",
"ThreadEvent", "ThreadEvent",
"GDB thread event object", "GDB thread event object",
event_object_type, event_object_type);
/*no qual*/);

View File

@ -41,7 +41,7 @@ typedef struct pyty_type_object
struct pyty_type_object *next; struct pyty_type_object *next;
} type_object; } type_object;
static PyTypeObject type_object_type extern PyTypeObject type_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object");
/* A Field object. */ /* A Field object. */
@ -53,7 +53,7 @@ typedef struct pyty_field_object
PyObject *dict; PyObject *dict;
} field_object; } field_object;
static PyTypeObject field_object_type extern PyTypeObject field_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object");
/* A type iterator object. */ /* A type iterator object. */
@ -67,7 +67,7 @@ typedef struct {
struct pyty_type_object *source; struct pyty_type_object *source;
} typy_iterator_object; } typy_iterator_object;
static PyTypeObject type_iterator_object_type extern PyTypeObject type_iterator_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object"); CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object");
/* This is used to initialize various gdb.TYPE_ constants. */ /* This is used to initialize various gdb.TYPE_ constants. */
@ -1539,7 +1539,7 @@ static PyMappingMethods typy_mapping = {
NULL /* no "set" method */ NULL /* no "set" method */
}; };
static PyTypeObject type_object_type = PyTypeObject type_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Type", /*tp_name*/ "gdb.Type", /*tp_name*/
@ -1588,7 +1588,7 @@ static PyGetSetDef field_object_getset[] =
{ NULL } { NULL }
}; };
static PyTypeObject field_object_type = PyTypeObject field_object_type =
{ {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.Field", /*tp_name*/ "gdb.Field", /*tp_name*/
@ -1630,7 +1630,7 @@ static PyTypeObject field_object_type =
0, /* tp_new */ 0, /* tp_new */
}; };
static PyTypeObject type_iterator_object_type = { PyTypeObject type_iterator_object_type = {
PyVarObject_HEAD_INIT (NULL, 0) PyVarObject_HEAD_INIT (NULL, 0)
"gdb.TypeIterator", /*tp_name*/ "gdb.TypeIterator", /*tp_name*/
sizeof (typy_iterator_object), /*tp_basicsize*/ sizeof (typy_iterator_object), /*tp_basicsize*/

View File

@ -57,8 +57,8 @@ static const char *gdbpy_should_print_stack = python_excp_message;
#ifdef HAVE_PYTHON #ifdef HAVE_PYTHON
/* Forward decls, these are defined later. */ /* Forward decls, these are defined later. */
static const struct extension_language_script_ops python_extension_script_ops; extern const struct extension_language_script_ops python_extension_script_ops;
static const struct extension_language_ops python_extension_ops; extern const struct extension_language_ops python_extension_ops;
#endif #endif
/* The main struct describing GDB's interface to the Python /* The main struct describing GDB's interface to the Python
@ -152,7 +152,7 @@ static enum ext_lang_rc gdbpy_before_prompt_hook
/* The interface between gdb proper and loading of python scripts. */ /* The interface between gdb proper and loading of python scripts. */
static const struct extension_language_script_ops python_extension_script_ops = const struct extension_language_script_ops python_extension_script_ops =
{ {
gdbpy_source_script, gdbpy_source_script,
gdbpy_source_objfile_script, gdbpy_source_objfile_script,
@ -162,7 +162,7 @@ static const struct extension_language_script_ops python_extension_script_ops =
/* The interface between gdb proper and python extensions. */ /* The interface between gdb proper and python extensions. */
static const struct extension_language_ops python_extension_ops = const struct extension_language_ops python_extension_ops =
{ {
gdbpy_finish_initialization, gdbpy_finish_initialization,
gdbpy_initialized, gdbpy_initialized,

View File

@ -47,7 +47,7 @@
/* Forward declaration. */ /* Forward declaration. */
static const struct probe_ops stap_probe_ops; extern const struct probe_ops stap_probe_ops;
/* Should we display debug information for the probe's argument expression /* Should we display debug information for the probe's argument expression
parsing? */ parsing? */
@ -1742,7 +1742,7 @@ stap_gen_info_probes_table_values (struct probe *probe_generic,
/* SystemTap probe_ops. */ /* SystemTap probe_ops. */
static const struct probe_ops stap_probe_ops = const struct probe_ops stap_probe_ops =
{ {
stap_probe_is_linespec, stap_probe_is_linespec,
stap_get_probes, stap_get_probes,