diff options
author | Weimin Pan <weimin.pan@oracle.com> | 2021-10-18 14:15:21 -0400 |
---|---|---|
committer | Weimin Pan <weimin.pan@oracle.com> | 2021-10-18 14:15:21 -0400 |
commit | b3a01ce2155d3532761f07639e00ce3d0317837d (patch) | |
tree | 401a78bd61bb190b2da7ccdd27248d49e18ff954 /gdb/dwarf2 | |
parent | 19b96124487358e723f920bfa30c272f5c0c5995 (diff) | |
download | gdb-b3a01ce2155d3532761f07639e00ce3d0317837d.zip gdb-b3a01ce2155d3532761f07639e00ce3d0317837d.tar.gz gdb-b3a01ce2155d3532761f07639e00ce3d0317837d.tar.bz2 |
CTF: incorrect underlying type setting for enumeration types
A bug was filed against the incorrect underlying type setting for
an enumeration type, which was caused by a copy and paste error.
This patch fixes the problem by setting it by calling objfile_int_type,
which was originally dwarf2_per_objfile::int_type, with ctf_type_size bits.
Also add error checking on ctf_func_type_info call.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/cu.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 26 | ||||
-rw-r--r-- | gdb/dwarf2/read.h | 4 |
3 files changed, 2 insertions, 30 deletions
diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c index 2a90ba8..e7aed77 100644 --- a/gdb/dwarf2/cu.c +++ b/gdb/dwarf2/cu.c @@ -46,7 +46,7 @@ struct type * dwarf2_cu::addr_sized_int_type (bool unsigned_p) const { int addr_size = this->per_cu->addr_size (); - return this->per_objfile->int_type (addr_size, unsigned_p); + return objfile_int_type (this->per_objfile->objfile, addr_size, unsigned_p); } /* Start a symtab for DWARF. NAME, COMP_DIR, LOW_PC are passed to the diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index cbd9a30..e456c37 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -17429,7 +17429,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) /* Pass 0 as the default as we know this attribute is constant and the default value will not be returned. */ LONGEST sz = len->constant_value (0); - prop_type = cu->per_objfile->int_type (sz, true); + prop_type = objfile_int_type (objfile, sz, true); } else { @@ -18480,30 +18480,6 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, /* See read.h. */ -struct type * -dwarf2_per_objfile::int_type (int size_in_bytes, bool unsigned_p) const -{ - struct type *int_type; - - /* Helper macro to examine the various builtin types. */ -#define TRY_TYPE(F) \ - int_type = (unsigned_p \ - ? objfile_type (objfile)->builtin_unsigned_ ## F \ - : objfile_type (objfile)->builtin_ ## F); \ - if (int_type != NULL && TYPE_LENGTH (int_type) == size_in_bytes) \ - return int_type - - TRY_TYPE (char); - TRY_TYPE (short); - TRY_TYPE (int); - TRY_TYPE (long); - TRY_TYPE (long_long); - -#undef TRY_TYPE - - gdb_assert_not_reached ("unable to find suitable integer type"); -} - /* Read the DW_AT_type attribute for a sub-range. If this attribute is not present (which is valid) then compute the default type based on the compilation units address size. */ diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index b57e1f9..1638d85 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -537,10 +537,6 @@ struct dwarf2_per_objfile void set_type_for_signatured_type (signatured_type *sig_type, struct type *type); - /* Find an integer type SIZE_IN_BYTES bytes in size and return it. - UNSIGNED_P controls if the integer is unsigned or not. */ - struct type *int_type (int size_in_bytes, bool unsigned_p) const; - /* Get the dwarf2_cu matching PER_CU for this objfile. */ dwarf2_cu *get_cu (dwarf2_per_cu_data *per_cu); |