Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!portal!cup.portal.com!Lee_Robert_Willis From: Lee_Robert_Willis@cup.portal.com Newsgroups: comp.sys.amiga.programmer Subject: Debugging C++ Message-ID: <42022@cup.portal.com> Date: 5 May 91 20:40:35 GMT Organization: The Portal System (TM) Lines: 97 re: Comeau C++ and debugging: Lee Willis> I'm very curious about how and to what extent SAS's CPR can Lee Willis> be used to debug Comeau's C++ code. (A debugger is a _big_ Lee Willis> issue. I wasn't considering buying your compiler until you Lee Willis> mentioned that C debuggers could be used) Greg Comeau> Line number and source file information is retained and that is simply Greg Comeau> accepted by the C compiler. There is no special trick involved. Well it sounds pretty magic to me. If I were to create my own language ("LEE++"), and a translater ("LEEfront") which read LEE++ source code, and spat out C source code, which was then fed through my SAS C compiler to produce an executable, I would not expect to be able to use the CPR debugger to debug native LEE++ code. CPR has no way of knowing that the C code was an _intermediate_ form, and that LEE++ was the actual source language. (CPR wouldn't know LEE++ from spam) Lee Willis> Could you post a file which contains some source code, and the Lee Willis> compiled executable (compiled with debug) so those of us with Lee Willis> debuggers could try it out for ourselves? Greg Comeau> I don't see what that would accomplish. For one, it might convince me to buy your product. Greg Comeau> ...It is my understanding that Greg Comeau> others here on the net have Comeau C++ and they are not Greg Comeau> disputing what I am saying. No one has confirmed it, either. If you think I'm confused, you're right. The following excerpts should explain WHY I'm confused: John W. Marvin> I assume there is no C++ debugger w/ Comeau? Greg Comeau> That is currently correct, however it is worth noting that as we Greg Comeau> currently are telling you to do something like "buy a C compiler Greg Comeau> too", the result is that you will have a C debugger like CPR and Greg Comeau> that works fine. Art Baker> Yes, but... Art Baker> Using CPR would allow you to look at the C which resulted Art Baker> from compiling the C++ source code. It would not give you the Art Baker> ability to debug at the C++ source level. This is a Art Baker> much-less-than-optimal solution. Greg Comeau> Not so at all. Greg Comeau> Greg Comeau> Using CPR allows you to debug/look at the C++ source Greg Comeau> _*NOT*_ the intermediate C. Micheal Rizzo> Another problem is that member function names of Micheal Rizzo> the form "class::function" get translated to some other C Micheal Rizzo> function name internally - I don't know for sure but I expect Micheal Rizzo> this is the case with Comeau C++ (that's how its done on GNU and Micheal Rizzo> Zortech). Greg Comeau> That is correct. ^^^^^^^^^^^^^^^^ This doesn't sound like source level debugging to me. Greg Comeau> ....We find that initial purchasers of Greg Comeau> Comeau C++ will sometimes call up about this, but often never Greg Comeau> call twice as they get used to it since C++ has many Greg Comeau> characteristics which diverts the energy normally spent in Greg Comeau> debugging into other areas of the programming cycle. Greg Comeau> Nevertheless, this is something that we spend time on solving Greg Comeau> with the ports of Comeau C++ we do. For instance, under UNIX we Greg Comeau> have something called CCsdb, which allows you to use to C++ names Greg Comeau> as is. Micheal Rizzo> With older versions of GNU gdb there was a small utility g++filt Micheal Rizzo> which one could use to translate between C++ and mangled Micheal Rizzo> identifiers. Used with a mouse cut-and-paste-text-between-windows Micheal Rizzo> as provided by xterm this was very useful. I believe such a PD Micheal Rizzo> utility for cutting & pasting text between console windows is Micheal Rizzo> available for the Amiga so maybe an equivalent of g++filt would Micheal Rizzo> be nice ? Greg Comeau> Comeau C++ comes with a utility we call c++filt, c++filt.CC, or Greg Comeau> comofilt depending upon the port (don't ask we why haven't Greg Comeau> standardized the name please) that supports just such a Greg Comeau> demangling capability. Why would one need a name-demangler if the debugger shows C++ source code? Do you see my confusion? Based solely on whats posted here on the net, (which is all the information I currently have) I am forced to conclude that using CPR to debug C++ is going to give me (at best) some sort of bastard hybrid environment, where the display shows C++ sometimes, and name-mangled C at others. If you post some source code and compiled executables, I can see for myself. Lee Lee_Robert_Willis@cup.portal.com