[antlr-interest] Problems debugging large grammar in Visual Studio 2005

troy runkel trunkel at gmail.com
Mon Aug 27 13:49:02 PDT 2007


I wanted to follow up on this issue and report what I've learned in
case anybody else runs across this problem.  I contacted Microsoft
Support and opened a case regarding this issue.  It turns out that the
Visual Studio 2005 debugger uses an unsigned short to track line
number information.  This means that the debugger will only work on
source files up to 64k lines long.  The next release of Visual Studio
is code named Orcas; the one after that Orcas+1.  Microsoft is not
planning to fix this limitation until Orcas+1, which could be several
years.

Microsoft Support suggested a couple of workarounds for this issue.

1) Use WinDbg instead of the Visual Studio debugger.  Apparently the
code in WinDbg is more recent and uses 32-bit variables to track line
number information.

2) Break up the ANTLR generated lexer and parser files into multiple
source files each less than 64k lines long.

Does ANTLR already have a good method of breaking up the generated files?

Troy Runkel


On 7/13/07, troy runkel <trunkel at gmail.com> wrote:
> I've applied VS2005 SP1 but that doesn't seem to have resolved the
> problem.  I'll check the hotfixes next and see if they have any
> applicable.  Thanks.
>
> --Troy
>
> >
> > Message: 6
> > Date: Fri, 13 Jul 2007 09:56:58 -0700
> > From: "Jim Idle" <jimi at temporal-wave.com>
> > Subject: Re: [antlr-interest] Problems debugging large grammar in
> >         Visual  Studio2005
> > To: "ANTLR mail-list" <antlr-interest at antlr.org>
> > Message-ID:
> >         <051466DAA0D608439E196797955018D76ECB at wavemachine.temporal-wave.com>
> > Content-Type: text/plain;       charset="US-ASCII"
> >
> > Have you applied SP1? There may also be some hotfixes on the VS2005 site
> > (I have loaded some of the performance related ones, but do not remember
> > loading anything for this type of error and my T-SQL parser is getting
> > on for that size.
> >
> > Perhaps you should not step into functions in the bottom half of the
> > file? ;-)
> >
> > Jim
> >
> > > -----Original Message-----
> > > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > > bounces at antlr.org] On Behalf Of troy runkel
> > > Sent: Friday, July 13, 2007 8:38 AM
> > > To: ANTLR mail-list
> > > Subject: [antlr-interest] Problems debugging large grammar in Visual
> > > Studio2005
> > >
> > > I'm using ANTLR v3 and the C target.  I have a large grammar file
> > > (2500 lines) which builds into an even larger C parser file (107000
> > > lines).  When debugging the generated parser in Visual Studio 2005, if
> > > I attempt to step into a function located in the bottom half of the
> > > file the debugger won't display the correct source location.  This
> > > behavior is fairly consistent.  I can step through/into functions in
> > > the top half of the file without problems.  As soon as I step into a
> > > function in the bottom half of the file the debugger displays
> > > incorrect source information.  I can debug at the assembly level, but
> > > that's a bit of a pain.
> > >
> > > I realize this is more of a compiler issue than an ANTLR issue, but
> > > before I attempt to navigate through the labyrinth of Microsoft
> > > technical support I thought I'd check here first.  Has anybody seen
> > > this sort of behavior?  Thanks.
> > >
> > > Troy Runkel
>


More information about the antlr-interest mailing list