gdb: Rename structures within ctfread.c
Commit:
commit 30d1f01849
Date: Mon Oct 7 00:46:52 2019 +0000
gdb: CTF support
Introduces some structures with names that are already in use within
GBB, this violates C++'s one-definition rule. Specifically the
structures 'nextfield' and 'field_info' are now defined in
dwarf2read.c and ctfread.c.
This commit renames the new structures (in ctfread.c), adding a 'ctf_'
prefix. Maybe we should consider renaming the DWARF versions too in
the future to avoid accidental conflicts.
gdb/ChangeLog:
* ctfread.c (struct nextfield): Renamed to ...
(struct ctf_nextfield): ... this.
(struct field_info): Renamed to ...
(strut ctf_field_info): ... this.
(attach_fields_to_type): Update for renamed structures.
(ctf_add_member_cb): Likewise.
(ctf_add_enum_member_cb): Likewise.
(process_struct_members): Likewise.
(process_enum_type): Likewise.
This commit is contained in:
parent
dfee856674
commit
b2caee6aaa
2 changed files with 26 additions and 14 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2019-10-07 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
|
* ctfread.c (struct nextfield): Renamed to ...
|
||||||
|
(struct ctf_nextfield): ... this.
|
||||||
|
(struct field_info): Renamed to ...
|
||||||
|
(strut ctf_field_info): ... this.
|
||||||
|
(attach_fields_to_type): Update for renamed structures.
|
||||||
|
(ctf_add_member_cb): Likewise.
|
||||||
|
(ctf_add_enum_member_cb): Likewise.
|
||||||
|
(process_struct_members): Likewise.
|
||||||
|
(process_enum_type): Likewise.
|
||||||
|
|
||||||
2019-10-07 Weimin Pan <weimin.pan@oracle.com>
|
2019-10-07 Weimin Pan <weimin.pan@oracle.com>
|
||||||
|
|
||||||
* ctfread.c: New file.
|
* ctfread.c: New file.
|
||||||
|
|
|
@ -98,17 +98,17 @@ typedef struct ctf_context
|
||||||
|
|
||||||
/* The routines that read and process fields/members of a C struct, union,
|
/* The routines that read and process fields/members of a C struct, union,
|
||||||
or enumeration, pass lists of data member fields in an instance of a
|
or enumeration, pass lists of data member fields in an instance of a
|
||||||
field_info structure. It is derived from dwarf2read.c. */
|
ctf_field_info structure. It is derived from dwarf2read.c. */
|
||||||
|
|
||||||
struct nextfield
|
struct ctf_nextfield
|
||||||
{
|
{
|
||||||
struct field field {};
|
struct field field {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct field_info
|
struct ctf_field_info
|
||||||
{
|
{
|
||||||
/* List of data member fields. */
|
/* List of data member fields. */
|
||||||
std::vector<struct nextfield> fields;
|
std::vector<struct ctf_nextfield> fields;
|
||||||
|
|
||||||
/* Context. */
|
/* Context. */
|
||||||
ctf_context_t *cur_context;
|
ctf_context_t *cur_context;
|
||||||
|
@ -269,7 +269,7 @@ set_symbol_address (struct objfile *of, struct symbol *sym, const char *name)
|
||||||
/* Create the vector of fields, and attach it to TYPE. */
|
/* Create the vector of fields, and attach it to TYPE. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
attach_fields_to_type (struct field_info *fip, struct type *type)
|
attach_fields_to_type (struct ctf_field_info *fip, struct type *type)
|
||||||
{
|
{
|
||||||
int nfields = fip->fields.size ();
|
int nfields = fip->fields.size ();
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ attach_fields_to_type (struct field_info *fip, struct type *type)
|
||||||
/* Copy the saved-up fields into the field vector. */
|
/* Copy the saved-up fields into the field vector. */
|
||||||
for (int i = 0; i < nfields; ++i)
|
for (int i = 0; i < nfields; ++i)
|
||||||
{
|
{
|
||||||
struct nextfield &field = fip->fields[i];
|
struct ctf_nextfield &field = fip->fields[i];
|
||||||
TYPE_FIELD (type, i) = field.field;
|
TYPE_FIELD (type, i) = field.field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ ctf_init_float_type (struct objfile *objfile,
|
||||||
|
|
||||||
/* Callback to add member NAME to a struct/union type. TID is the type
|
/* Callback to add member NAME to a struct/union type. TID is the type
|
||||||
of struct/union member, OFFSET is the offset of member in bits,
|
of struct/union member, OFFSET is the offset of member in bits,
|
||||||
and ARG contains the field_info. */
|
and ARG contains the ctf_field_info. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ctf_add_member_cb (const char *name,
|
ctf_add_member_cb (const char *name,
|
||||||
|
@ -322,9 +322,9 @@ ctf_add_member_cb (const char *name,
|
||||||
unsigned long offset,
|
unsigned long offset,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
struct field_info *fip = (struct field_info *) arg;
|
struct ctf_field_info *fip = (struct ctf_field_info *) arg;
|
||||||
ctf_context_t *ccp = fip->cur_context;
|
ctf_context_t *ccp = fip->cur_context;
|
||||||
struct nextfield new_field;
|
struct ctf_nextfield new_field;
|
||||||
struct field *fp;
|
struct field *fp;
|
||||||
struct type *t;
|
struct type *t;
|
||||||
uint32_t kind;
|
uint32_t kind;
|
||||||
|
@ -358,13 +358,13 @@ ctf_add_member_cb (const char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback to add member NAME of EVAL to an enumeration type.
|
/* Callback to add member NAME of EVAL to an enumeration type.
|
||||||
ARG contains the field_info. */
|
ARG contains the ctf_field_info. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
|
ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
|
||||||
{
|
{
|
||||||
struct field_info *fip = (struct field_info *) arg;
|
struct ctf_field_info *fip = (struct ctf_field_info *) arg;
|
||||||
struct nextfield new_field;
|
struct ctf_nextfield new_field;
|
||||||
struct field *fp;
|
struct field *fp;
|
||||||
ctf_context_t *ccp = fip->cur_context;
|
ctf_context_t *ccp = fip->cur_context;
|
||||||
|
|
||||||
|
@ -587,7 +587,7 @@ process_struct_members (ctf_context_t *ccp,
|
||||||
ctf_id_t tid,
|
ctf_id_t tid,
|
||||||
struct type *type)
|
struct type *type)
|
||||||
{
|
{
|
||||||
struct field_info fi;
|
struct ctf_field_info fi;
|
||||||
|
|
||||||
fi.cur_context = ccp;
|
fi.cur_context = ccp;
|
||||||
if (ctf_member_iter (ccp->fp, tid, ctf_add_member_cb, &fi) == CTF_ERR)
|
if (ctf_member_iter (ccp->fp, tid, ctf_add_member_cb, &fi) == CTF_ERR)
|
||||||
|
@ -665,7 +665,7 @@ static void
|
||||||
process_enum_type (ctf_context_t *ccp, ctf_id_t tid)
|
process_enum_type (ctf_context_t *ccp, ctf_id_t tid)
|
||||||
{
|
{
|
||||||
struct type *type;
|
struct type *type;
|
||||||
struct field_info fi;
|
struct ctf_field_info fi;
|
||||||
|
|
||||||
type = read_enum_type (ccp, tid);
|
type = read_enum_type (ccp, tid);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue