Fix a couple C++ build issues
Building mingw GDB with --enable-build-with-cxx shows: ../../binutils-gdb/gdb/python/py-unwind.c:500:45: error: cannot convert 'cached_frame_info::reg_info*' to 'pyuw_prev_register(frame_info*, void**, int)::reg_info*' in initialization struct reg_info *reg_info = cached_frame->reg; ^ ../../binutils-gdb/gdb/python/py-unwind.c:501:60: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info' struct reg_info *reg_info_end = reg_info + cached_frame->reg_count; ^ ../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info' struct reg_info *reg_info = cached_frame->reg; ^ ../../binutils-gdb/gdb/python/py-unwind.c:505:37: error: cannot increment a pointer to incomplete type 'pyuw_prev_register(frame_info*, void**, int)::reg_info' for (; reg_info < reg_info_end; ++reg_info) ^ ../../binutils-gdb/gdb/python/py-unwind.c:507:29: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info' if (regnum == reg_info->number) ^ ../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info' struct reg_info *reg_info = cached_frame->reg; ^ ../../binutils-gdb/gdb/python/py-unwind.c:508:68: error: invalid use of incomplete type 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info' return frame_unwind_got_bytes (this_frame, regnum, reg_info->data); ^ ../../binutils-gdb/gdb/python/py-unwind.c:500:10: error: forward declaration of 'struct pyuw_prev_register(frame_info*, void**, int)::reg_info' struct reg_info *reg_info = cached_frame->reg; ^ ../../binutils-gdb/gdb/python/py-unwind.c: In function 'int pyuw_sniffer(const frame_unwind*, frame_info*, void**)': ../../binutils-gdb/gdb/python/py-unwind.c:574:70: warning: invalid conversion from 'void*' to 'cached_frame_info*' [-fpermissive] reg_count * sizeof (cached_frame->reg[0])); ^ ../../binutils-gdb/gdb/python/py-unwind.c: In function 'void pyuw_on_new_gdbarch(gdbarch*)': ../../binutils-gdb/gdb/python/py-unwind.c:636:47: warning: invalid conversion from 'void*' to 'pyuw_gdbarch_data_type*' [-fpermissive] gdbarch_data (newarch, pyuw_gdbarch_data); ^ ../../binutils-gdb/gdb/python/py-unwind.c:647:29: warning: invalid conversion from 'void*' to 'const frame_data*' [-fpermissive] unwinder->unwind_data = (void *) newarch; ^ ../../binutils-gdb/gdb/python/py-unwind.c: At global scope: ../../binutils-gdb/gdb/python/py-unwind.c:699:21: error: redefinition of 'PyTypeObject pending_frame_object_type' static PyTypeObject pending_frame_object_type = ^ ../../binutils-gdb/gdb/python/py-unwind.c:96:21: error: 'PyTypeObject pending_frame_object_type' previously declared here static PyTypeObject pending_frame_object_type ^ ../../binutils-gdb/gdb/python/py-unwind.c:749:21: error: redefinition of 'PyTypeObject unwind_info_object_type' static PyTypeObject unwind_info_object_type = ^ ../../binutils-gdb/gdb/python/py-unwind.c:99:21: error: 'PyTypeObject unwind_info_object_type' previously declared here static PyTypeObject unwind_info_object_type ^ The first kind of error is caused by the embedded struct definition, so move it out of the parent struct. The second kind of error is caused by forward declaring a static global variable, which works in C, but not in C++ (or C with -fno-common). Make it using extern instead, like done in other similar cases. gdb/ChangeLog: 2015-05-15 Yuanhui Zhang <asmwarrior@gmail.com> * python/py-unwind.c (struct reg_info): Move out of ... (struct cached_frame_info): ... this scope. (pending_frame_object_type, unwind_info_object_type): Make extern.
This commit is contained in:
parent
9cd4d857bb
commit
13fa0398d7
2 changed files with 20 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
|||
2015-05-15 Yuanhui Zhang <asmwarrior@gmail.com>
|
||||
|
||||
* python/py-unwind.c (struct reg_info): Move out of ...
|
||||
(struct cached_frame_info): ... this scope.
|
||||
(pending_frame_object_type, unwind_info_object_type): Make extern.
|
||||
|
||||
2015-05-15 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* ada-lang.c (ada_value_primitive_packed_val): Make sure
|
||||
|
|
|
@ -72,6 +72,15 @@ typedef struct
|
|||
/* The data we keep for a frame we can unwind: frame ID and an array of
|
||||
(register_number, register_value) pairs. */
|
||||
|
||||
struct reg_info
|
||||
{
|
||||
/* Register number. */
|
||||
int number;
|
||||
|
||||
/* Register data bytes pointer. */
|
||||
gdb_byte data[MAX_REGISTER_SIZE];
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Frame ID. */
|
||||
|
@ -83,20 +92,13 @@ typedef struct
|
|||
/* Length of the `reg' array below. */
|
||||
int reg_count;
|
||||
|
||||
struct reg_info
|
||||
{
|
||||
/* Register number. */
|
||||
int number;
|
||||
|
||||
/* Register data bytes pointer. */
|
||||
gdb_byte data[MAX_REGISTER_SIZE];
|
||||
} reg[];
|
||||
struct reg_info reg[];
|
||||
} cached_frame_info;
|
||||
|
||||
static PyTypeObject pending_frame_object_type
|
||||
extern PyTypeObject pending_frame_object_type
|
||||
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pending_frame_object");
|
||||
|
||||
static PyTypeObject unwind_info_object_type
|
||||
extern PyTypeObject unwind_info_object_type
|
||||
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("unwind_info_object");
|
||||
|
||||
static unsigned int pyuw_debug = 0;
|
||||
|
@ -696,7 +698,7 @@ static PyMethodDef pending_frame_object_methods[] =
|
|||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyTypeObject pending_frame_object_type =
|
||||
PyTypeObject pending_frame_object_type =
|
||||
{
|
||||
PyVarObject_HEAD_INIT (NULL, 0)
|
||||
"gdb.PendingFrame", /* tp_name */
|
||||
|
@ -746,7 +748,7 @@ static PyMethodDef unwind_info_object_methods[] =
|
|||
{ NULL } /* Sentinel */
|
||||
};
|
||||
|
||||
static PyTypeObject unwind_info_object_type =
|
||||
PyTypeObject unwind_info_object_type =
|
||||
{
|
||||
PyVarObject_HEAD_INIT (NULL, 0)
|
||||
"gdb.UnwindInfo", /* tp_name */
|
||||
|
|
Loading…
Reference in a new issue