Do not manually dissect OP_TYPE operations

Some code in GDB will examine the structure of an expression to see if
it starts with OP_TYPE, and then proceed to extract the type by hand.

There is no need to do this dissection manually.  evaluate_type does
the same thing via an "allowed" API.

This patch changes such code to use evaluate_type.  In two cases this
simplifies the code.

Regression tested on x86-64 Fedora 28.

gdb/ChangeLog
2020-12-14  Tom Tromey  <tom@tromey.com>

	* dtrace-probe.c (dtrace_process_dof_probe): Use value_type.
	* typeprint.c (whatis_exp): Always use evaluate_type.
	(maintenance_print_type): Likewise.  Simplify.
This commit is contained in:
Tom Tromey
2020-12-14 09:43:20 -07:00
parent 18f1cb1fc5
commit a6f3c8a1a8
3 changed files with 15 additions and 29 deletions

View File

@@ -493,7 +493,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
}
if (expr != NULL && expr.get ()->elts[0].opcode == OP_TYPE)
type = expr.get ()->elts[1].type;
type = value_type (evaluate_type (expr.get ()));
args.emplace_back (type, std::move (type_str), std::move (expr));
}