Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!sol.ctr.columbia.edu!emory!att!att!ima!iecc!compilers-sender From: meissner@osf.org Newsgroups: comp.compilers Subject: Re: yacc & dbx Keywords: yacc, debug Message-ID: <9101311952.AA05132@curley.osf.org> Date: 31 Jan 91 19:52:38 GMT References: <299@ptcburp.ptcbu.oz.au> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: meissner@osf.org Organization: Compilers Central Lines: 71 Approved: compilers@iecc.cambridge.ma.us | htf@castle.edinburgh.ac.uk (H T Fallside) writes: | | >Anyone have any suggestions about ways of getting dbx to behave sensibly | >with a yacc generated parser as part of the program - ie indexing into the | >source during debug ? Michael Henning writes: | There is not necessarily any sensible way to deal with #line directives in | the generated .c file. The easiest thing is usually to pre-process the | generated code with sed or some other tool to remove the #line directives | before compilation. And John writes: | [My experience is quite different; I've found it quite useful to put in | breakpoints and single step by line in the .y file. If you don't like the | #line directives, the -l flag to yacc prevents them. -John] It depends on what your object format is, whether it can handle #line directives or not. There are two inter-related problems -- whether multiple files are handled within one object file format, and whether line numbers within a function can vary outside of the range of the function's start/end (or even if they must be monotonically increasing). Typical parser generators, require changing both the filename and line number within a function to switch between the actions and rules files. Going over the object files I've dealt with in the past gives: 1. Berkeley stabs ================== This allows multiple .file and/or .line directives. 2. System V.[0123] coff ======================== Pure COFF only allows one file in a compilation unit. Line numbers are relative to the start of the function, and must be positive, which makes debugging inlines a pain as well. 3. Third Eye ECOFF (used on MIPS) ================================== ECOFF allows multiple files within a compilation unit, though you cannot change the file within a function boundary. Line numbers are relative to the start of the function, though negative values are allowed. You must not have more than 65K of lines separating two adjacent statements. 4. OSF/rose ============ At present, we use Berkeley stabs and do not have a problem. 5. Dwarf (System V.4) ====================== I can't find in my dwarf documents whether this is allowed or not, though I remember a comment about trying to remove the restriction that lines for a file be contigous, which would mean that you possibly would have to have a separate file section for each #line that introduced a filename, different from the previous. -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142 -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.