aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/ctfread.c5
-rw-r--r--gdb/dwarf2/read.c2
-rw-r--r--gdb/fbsd-tdep.c4
-rw-r--r--gdb/gdbtypes.c8
-rw-r--r--gdb/gdbtypes.h14
-rw-r--r--gdb/linux-tdep.c6
-rw-r--r--gdb/mdebugread.c2
-rw-r--r--gdb/stabsread.c2
9 files changed, 34 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index aac62fc..644d700 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
+ * gdbtypes.h (struct type) <target_is_stub, set_target_is_stub>:
+ New methods.
+ (TYPE_TARGET_STUB): Use type::is_stub, change all write call
+ sites to use type::set_target_is_stub.
+
+2020-09-14 Simon Marchi <simon.marchi@efficios.com>
+
* gdbtypes.h (TYPE_STUB): Remove, replace all
uses with type::is_stub.
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 14f6404..81490ba 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -776,7 +776,7 @@ read_array_type (struct ctf_context *ccp, ctf_id_t tid)
{
range_type->bounds ()->high.set_undefined ();
TYPE_LENGTH (type) = 0;
- TYPE_TARGET_STUB (type) = 1;
+ type->set_target_is_stub (true);
}
else
TYPE_LENGTH (type) = ctf_type_size (fp, tid);
@@ -876,7 +876,8 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid,
TYPE_TARGET_TYPE (this_type) = target_type;
else
TYPE_TARGET_TYPE (this_type) = NULL;
- TYPE_TARGET_STUB (this_type) = TYPE_TARGET_TYPE (this_type) ? 1 : 0;
+
+ this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) != nullptr);
return set_tid_type (objfile, tid, this_type);
}
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b935833..5f02acc 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -17795,7 +17795,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu)
name = dwarf2_full_name (NULL, die, cu);
this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, name);
- TYPE_TARGET_STUB (this_type) = 1;
+ this_type->set_target_is_stub (true);
set_die_type (die, this_type, cu);
target_type = die_type (die, cu);
if (target_type != this_type)
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index ca397fa..a462e4d 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -1643,14 +1643,14 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch)
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int32_type) * TARGET_CHAR_BIT, "__pid_t");
TYPE_TARGET_TYPE (pid_type) = int32_type;
- TYPE_TARGET_STUB (pid_type) = 1;
+ pid_type->set_target_is_stub (true);
/* __uid_t */
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (uint32_type) * TARGET_CHAR_BIT,
"__uid_t");
TYPE_TARGET_TYPE (uid_type) = uint32_type;
- TYPE_TARGET_STUB (uid_type) = 1;
+ pid_type->set_target_is_stub (true);
/* _reason */
reason_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 492061f..6dc073f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -935,7 +935,7 @@ create_range_type (struct type *result_type, struct type *index_type,
result_type->set_code (TYPE_CODE_RANGE);
TYPE_TARGET_TYPE (result_type) = index_type;
if (index_type->is_stub ())
- TYPE_TARGET_STUB (result_type) = 1;
+ result_type->set_target_is_stub (true);
else
TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
@@ -1307,7 +1307,7 @@ create_array_type_with_stride (struct type *result_type,
/* TYPE_TARGET_STUB will take care of zero length arrays. */
if (TYPE_LENGTH (result_type) == 0)
- TYPE_TARGET_STUB (result_type) = 1;
+ result_type->set_target_is_stub (true);
return result_type;
}
@@ -2875,11 +2875,11 @@ check_typedef (struct type *type)
else if (type->code () == TYPE_CODE_RANGE)
{
TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
- TYPE_TARGET_STUB (type) = 0;
+ type->set_target_is_stub (false);
}
else if (type->code () == TYPE_CODE_ARRAY
&& update_static_array_size (type))
- TYPE_TARGET_STUB (type) = 0;
+ type->set_target_is_stub (false);
}
type = make_qualified_type (type, instance_flags, NULL);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index bceb1b8..c6c2518 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -222,7 +222,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
based on the TYPE_LENGTH of the target type. Also, set for
TYPE_CODE_TYPEDEF. */
-#define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub)
+#define TYPE_TARGET_STUB(t) ((t)->target_is_stub ())
/* * This is a function type which appears to have a prototype. We
need this for function calls in order to tell us if it's necessary
@@ -841,7 +841,7 @@ struct main_type
unsigned int m_flag_unsigned : 1;
unsigned int m_flag_nosign : 1;
unsigned int m_flag_stub : 1;
- unsigned int flag_target_stub : 1;
+ unsigned int m_flag_target_stub : 1;
unsigned int flag_prototyped : 1;
unsigned int flag_varargs : 1;
unsigned int flag_vector : 1;
@@ -1092,6 +1092,16 @@ struct type
this->main_type->m_flag_stub = is_stub;
}
+ bool target_is_stub () const
+ {
+ return this->main_type->m_flag_target_stub;
+ }
+
+ void set_target_is_stub (bool target_is_stub)
+ {
+ this->main_type->m_flag_target_stub = target_is_stub;
+ }
+
/* * Return the dynamic property of the requested KIND from this type's
list of dynamic properties. */
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 0b2b032..a0d954a 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -266,20 +266,20 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int_type) * TARGET_CHAR_BIT, "__pid_t");
TYPE_TARGET_TYPE (pid_type) = int_type;
- TYPE_TARGET_STUB (pid_type) = 1;
+ pid_type->set_target_is_stub (true);
/* __uid_t */
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (uint_type) * TARGET_CHAR_BIT, "__uid_t");
TYPE_TARGET_TYPE (uid_type) = uint_type;
- TYPE_TARGET_STUB (uid_type) = 1;
+ uid_type->set_target_is_stub (true);
/* __clock_t */
clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (long_type) * TARGET_CHAR_BIT,
"__clock_t");
TYPE_TARGET_TYPE (clock_type) = long_type;
- TYPE_TARGET_STUB (clock_type) = 1;
+ clock_type->set_target_is_stub (true);
/* _sifields */
sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 735f008..f68f4ef 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1866,7 +1866,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
/* TYPE_TARGET_STUB now takes care of the zero TYPE_LENGTH problem. */
if (TYPE_LENGTH (*tpp) == 0)
- TYPE_TARGET_STUB (t) = 1;
+ t->set_target_is_stub (true);
*tpp = t;
return 4 + off;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 33a23cb..752612f 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1716,7 +1716,7 @@ again:
}
else
{
- TYPE_TARGET_STUB (type) = 1;
+ type->set_target_is_stub (true);
TYPE_TARGET_TYPE (type) = xtype;
}
}