Skip to content

Commit 35add35

Browse files
committed
gdb: Fix failure in gdb.base/complex-parts.exp for x86-32
The x86-32 ABI specifies 96-bit long double, this was causing a failure on the test gdb.base/complex-parts.exp. The problem is that GDB tries to find a builtin floating point type of the correct size in order to reuse the name of that type as the name for the components of the complex type being built. Previously GDB was only aware of floating point types sized 32, 64, or 128 bits. This patch teaches GDB how to handle 96 bit floating point type. gdb/ChangeLog: * dwarf2read.c (dwarf2_init_complex_target_type): Handle complex target types of size 96-bits, add some additional comments, and check that the builtin type we found was the correct size.
1 parent 9c9f1b1 commit 35add35

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

gdb/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2019-04-13 Andrew Burgess <[email protected]>
2+
3+
* dwarf2read.c (dwarf2_init_complex_target_type): Handle complex
4+
target types of size 96-bits, add some additional comments, and
5+
check that the builtin type we found was the correct size.
6+
17
2019-04-12 Eli Zaretskii <[email protected]>
28

39
* utils.c (prompt_for_continue): Don't restore the styling at the

gdb/dwarf2read.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17546,6 +17546,9 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
1754617546
gdbarch *gdbarch = get_objfile_arch (objfile);
1754717547
struct type *tt = nullptr;
1754817548

17549+
/* Try to find a suitable floating point builtin type of size BITS.
17550+
We're going to use the name of this type as the name for the complex
17551+
target type that we are about to create. */
1754917552
switch (bits)
1755017553
{
1755117554
case 32:
@@ -17554,11 +17557,18 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
1755417557
case 64:
1755517558
tt = builtin_type (gdbarch)->builtin_double;
1755617559
break;
17560+
case 96: /* The x86-32 ABI specifies 96-bit long double. */
1755717561
case 128:
1755817562
tt = builtin_type (gdbarch)->builtin_long_double;
1755917563
break;
1756017564
}
1756117565

17566+
/* If the type we found doesn't match the size we were looking for, then
17567+
pretend we didn't find a type at all, the complex target type we
17568+
create will then be nameless. */
17569+
if (TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
17570+
tt = nullptr;
17571+
1756217572
const char *name = (tt == nullptr) ? nullptr : TYPE_NAME (tt);
1756317573
return dwarf2_init_float_type (objfile, bits, name, name_hint);
1756417574
}

0 commit comments

Comments
 (0)