Re: how to debug yacc file using gdb

copperma@grenoble.rxrc.xerox.com (Max Copperman)
Fri, 6 Jan 1995 16:56:25 GMT

          From comp.compilers

Related articles
how to debug yacc file using gdb linwei@iscs.nus.sg (1994-12-31)
Re: how to debug yacc file using gdb fjh@munta.cs.mu.OZ.AU (1995-01-04)
Re: how to debug yacc file using gdb copperma@grenoble.rxrc.xerox.com (1995-01-06)
| List of all articles for this month |

Newsgroups: comp.compilers
From: copperma@grenoble.rxrc.xerox.com (Max Copperman)
Keywords: yacc, debug
Organization: Rank Xerox Research Centre - Grenoble Laboratory
References: 94-12-152
Date: Fri, 6 Jan 1995 16:56:25 GMT

linwei@iscs.nus.sg (Lin Wei) writes:
> ... it was clumsy to debug
> y.tab.c using gdb. ... it seems impossible to print/display yacc's
> attribute variables like $$ and $1 ...
>
> [In most Unix versions of yacc, $$ is stored in yyval. But that's a hack,
> it would indeed be nice to arrange for preprecessors like yacc and lex and
> debuggers to communicate. -John]


While I'm waiting for the tools to communicate well, I deal with this
problem manually. for example, I write:


    reg_exp2 : reg_exp1 binary_op reg_exp2
{ lptr pArg1 = $1;
lptr pArg2 = $3;
lptr pOp = $2;
pOp = fAppend(pOp, pArg1);
pOp = fAppend(pOp, pArg2);
$$ = pOp;
}


gdb can display pArg1 etc. without difficulty. I trust the compiler to
eliminate unnecessary stores. It isn't rocket science, but it works.


Max Copperman
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.