home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sun.misc
- Path: sparky!uunet!utcsri!newsflash.concordia.ca!mizar.cc.umanitoba.ca!thompsn
- From: thompsn@ccu.umanitoba.ca (Adam Thompson)
- Subject: Re: debugging programs compiled with pc
- Message-ID: <BzA7B0.Dpp@ccu.umanitoba.ca>
- Sender: news@ccu.umanitoba.ca
- Nntp-Posting-Host: ccu.umanitoba.ca
- Organization: University of Manitoba, Winnipeg, Canada
- References: <1992Dec9.231642.15897@ida.liu.se>
- Date: Tue, 15 Dec 1992 03:35:23 GMT
- Lines: 47
-
- In <1992Dec9.231642.15897@ida.liu.se> davpa@ida.liu.se (David Partain) writes:
-
- >I'm trying to help a student here who's having difficulty debugging
- >pascal. The symptoms are very frustrating, and I haven't looked at
- >pascal in years, so I'm turning to y'all to see if you have seen the
- >problem before.
-
- >Platform:
- >SunOS 4.1.2, Sparcs, using PC-2.1
-
- >Symptoms:
- >Bunches of .o files, compiled with -g as they should be.
- >Some functions seem to have symbols, some don't. I start up the
- >debugger (doesn't matter whether I use gdb, dbx, or ups), and try to
- >break in a function. Guess what? It doesn't know about that function.
- >Of course, the function from which it was called it DOES know about, and
- >it's in the same supposedly debuggable executable. dbx can't even list
- >the function, whereas gdb can. this seems to be a result of being a
- >function called by a function called by the main program, but I don't
- >know. Have any of you seen anything like this before? Can anyone tell
- >me what needs to be done so that we can debug pascal?
-
- (sorry about the extensive quoting...)
-
- The solution is a bit obscure -- ld(1) appears to generate a symbol
- table that contains only identifiers declared at the 'main' level.
- I think it is referenced as 'Program' instead of 'main'. A systematic
- fix is to have your main file consist of:
-
- #include <external_defs.h>
-
- begin
- mainline;
- end.
- and have the file external_defs.h (or .p or whatever you feel like!)
- contain 'external' definitions of all functions. That main file should
- be compiled separately, and linked with mainline.o. This should allow
- dbx, at least to figure things out correctly. If you use gdb
- extensively, you should be aware that it works a *lot* better if you
- specify the modula-2 as the language instead of C.
-
- -Adam Thompson
- thompsn@ccu.umanitoba.ca
- --
- +----------------------------------------------------------------------+
- | Adam Thompson University of Manitoba Computer Services |
- | thompsn@ccu.umanitoba.ca OLC Project - Unix Group |
-