public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Debugging the GCC compiler proper 'cc1'
@ 2001-01-18 21:31 Mahadev K Cholachagudda
  2001-01-19  7:24 ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Mahadev K Cholachagudda @ 2001-01-18 21:31 UTC (permalink / raw)
  To: Gcc-Help@Gcc.Gnu.Org; +Cc: Crossgcc-Help

Hi all,

Plese include mailto:kcmahadev@zilogindia.com , mailto:kkiran@zilogindia.com
while replying.

Thanks

here the problem goes.
Any help is welcome.

Thanks
With best regards,

\/ \/   Mahadev K. Cholachagudda
O . O   mailto:kcmahadev@zilogindia.com
 ( )



The compiler for m68k-coff on sun machine has
been built successfully.

It has been build with -g option.

Now when running the gdb with cc1
compiler we are not able to go into
yyparse function.

The following procedure is followed while running the gdb.
**************************************************************
>gdb /somepath/build_m68k/gcc/cc1
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.5"...

(gdb) b main
Breakpoint 1 at 0x38de4: file ../../src/gcc/toplev.c, line 4755.

(gdb) b yyparse
Breakpoint 2 at 0x16aaf4: file /opt/gnu/share/bison.simple, line 225.

(gdb) run test.c
Starting program: /somepath/build_m68k/gcc/cc1 test.c
.cshrc file execution

Breakpoint 1, main (argc=2, argv=0xffbef55c) at ../../src/gcc/toplev.c:4755
4755      char *filename = 0;
(gdb) continue
Continuing.

Breakpoint 2, yyparse () at /opt/gnu/share/bison.simple:225
225       int yychar1 = 0;              /*  look

**************************************************************
As can be seen from the above description,
when breakpoint is set in yyparse()
it is neither set at c-parse.y file nor in the
corresponding bison generated file c-parse.c

It is getting set at location bison.simple.

What is the reason for this behaviour and
Are we missing something here.

We are able to find the various reductions the
parser is undergoing by giving -dy option for cc1.

How to debug the gcc code as it passes
through the various reductions in the LALR
parser genrated by the bison?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Debugging the GCC compiler proper 'cc1'
  2001-01-18 21:31 Debugging the GCC compiler proper 'cc1' Mahadev K Cholachagudda
@ 2001-01-19  7:24 ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2001-01-19  7:24 UTC (permalink / raw)
  To: Mahadev K Cholachagudda; +Cc: Gcc-Help@Gcc.Gnu.Org, Crossgcc-Help

On Jan 19, 2001, "Mahadev K Cholachagudda" <kcmahadev@zilogindia.com> wrote:

> (gdb) b yyparse
> Breakpoint 2 at 0x16aaf4: file /opt/gnu/share/bison.simple, line 225.

> As can be seen from the above description,
> when breakpoint is set in yyparse()
> it is neither set at c-parse.y file nor in the
> corresponding bison generated file c-parse.c

> It is getting set at location bison.simple.

> What is the reason for this behaviour and
> Are we missing something here.

The reason is that bison's output includes the `bison.simple' file
preceded by a `#line' directive, so that the debugger knows where the
file came from.  In my case, it looks like this:

#line 3 "/n/gnu/bison-1.28/share/bison.simple"
/* This file comes from bison-1.28.  */
...

> How to debug the gcc code as it passes
> through the various reductions in the LALR
> parser genrated by the bison?

I suggest adding some debugging options to the invocation of bison.
Single-stepping through bison's parsing engine is probably not a good
idea.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-01-19  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-18 21:31 Debugging the GCC compiler proper 'cc1' Mahadev K Cholachagudda
2001-01-19  7:24 ` Alexandre Oliva

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).