public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: mike stump <mrs@windriver.com>
To: danishsamad@yahoo.com, gcc@gcc.gnu.org
Subject: Re: problems debugging gcc
Date: Tue, 04 Dec 2001 11:59:00 -0000	[thread overview]
Message-ID: <200112041958.LAA06265@kankakee.wrs.com> (raw)

> Date: Tue, 4 Dec 2001 01:21:29 -0800 (PST)
> From: Danish Samad <danishsamad@yahoo.com>
> To: gcc@gcc.gnu.org

> I am facing some problems debugging gcc. Whenever I try to step into
> the function yyparse(), in the toplevel.c file, it steps into
> bison.simple instead of c-parse.c. Although there is a portion in
> bison.simple which says that the action file gets copied here but
> while debugging this portion it says file out of range.  Any
> solution to this problem?

Yes.  Step through bison.simple a couple hundred times, and you'll
discover that most of the time, it spends it's time in about two to
four places you care about.  One place, is dispatching to actions.  It
can be felt, by noticing the line (at least in bison 1.25):

  switch (yyn) {

and the fact that when you step it, it will be at a line in your
parse.y file.  If you set a break point on that line, with the command
step 1, you will discover that you always wind up stopped inside an
action, and that you always stop for all actions.  This is very handy.

The next thing that is handy, is to have compiled with -DYYDEBUG=1 and
set yydebug to 1, and then set a break point on the lines like (again,
these are from bison 1.25, your mileage may vary):

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

      fprintf (stderr, "Reducing via rule %d (line %d), ",
               yyn, yyrline[yyn]);

depending upon what you want to see.  Feel free to contribute this to
the bison manual, if it helps you.  About the out of range stuff, best
to just ignore it, step until you get someplace you want to be.

             reply	other threads:[~2001-12-04 19:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-04 11:59 mike stump [this message]
2001-12-04 12:34 ` Neil Booth
2001-12-04 13:08   ` [c/4053] " Daniel Jacobowitz
2001-12-04 13:18     ` Neil Booth
2001-12-04 14:24   ` Geoff Keating
2001-12-04 14:31     ` Neil Booth
2001-12-04 15:27       ` Geoff Keating
2001-12-04 15:37         ` Neil Booth
2001-12-05 15:43           ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2001-12-04  1:21 Danish Samad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200112041958.LAA06265@kankakee.wrs.com \
    --to=mrs@windriver.com \
    --cc=danishsamad@yahoo.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).