[qfcc] Make print_operand usable from gdb

It not emitting a \n made life difficult, especially whenever gdb
decided to make access to printf or puts awkward.
This commit is contained in:
Bill Currie 2020-03-16 20:20:07 +09:00
parent b544a052bf
commit db06300ddd

View file

@ -158,8 +158,8 @@ operand_string (operand_t *op)
return ("??"); return ("??");
} }
void static void
print_operand (operand_t *op) _print_operand (operand_t *op)
{ {
switch (op->op_type) { switch (op->op_type) {
case op_def: case op_def:
@ -224,7 +224,7 @@ print_operand (operand_t *op)
break; break;
case op_alias: case op_alias:
printf ("alias(%s,", pr_type_name[op->type->type]); printf ("alias(%s,", pr_type_name[op->type->type]);
print_operand (op->o.alias); _print_operand (op->o.alias);
printf (")"); printf (")");
break; break;
case op_nil: case op_nil:
@ -233,18 +233,25 @@ print_operand (operand_t *op)
} }
} }
void
print_operand (operand_t *op)
{
_print_operand (op);
puts ("");
}
void void
print_statement (statement_t *s) print_statement (statement_t *s)
{ {
printf ("(%s, ", s->opcode); printf ("(%s, ", s->opcode);
if (s->opa) if (s->opa)
print_operand (s->opa); _print_operand (s->opa);
printf (", "); printf (", ");
if (s->opb) if (s->opb)
print_operand (s->opb); _print_operand (s->opb);
printf (", "); printf (", ");
if (s->opc) if (s->opc)
print_operand (s->opc); _print_operand (s->opc);
printf (")\n"); printf (")\n");
} }