From: Russell Browne (russ_at_amc.com)
Date: Wed Feb 14 2001 - 01:35:27 GMT
Hi Bob. > Hello! > > I have a hopefully simple question regarding the #pragma > construct. Specifically, I'm using the #pragma construct > available under g++ to minimize duplication of symbols > and templates when an include file with class definitions > is included in multiple source files. > > Unfortunately, if I use this feature in my C++ files, > then UPS does not appear able to obtain the class > definitions in any except the class implementation file. > I have included a small example below demonstrating this > behavior. It is a uuencoded, gzipped tar archive. There > is a Makefile, and simply typing "make" will create and > launch ups (assumed to be in one's path) on the problematic > version of the program. > > Within ups, create a breakpoint anywhere in the code, then > start it. Click on variable "a" in main(). You will see > the following listing for it: > > undefined struct myPragmaClass <a> <Zero size object> > > By avoiding the use of the #pragma construct (which can be > done by using "make no_prob"), this problem does not occur. > > So, my hopefully simple question is, is this a problem with > using #pragma and trying to debug under UPS, or am I just > using a bad coding style? If it is the former, is this > something that can be handled by a relatively simple fix > to UPS? > > Thanks! > > Bob Carragher First, thanks for attaching such a nicely packaged example of your problem! I readily reproduced it on a Solaris workstation. Unfortunately, I don't think it is a simple fix. But it is a problem that should be fixed. ( Those who don't want to know more than anyone should know about stabs debug info should stop reading here.) The problem is that UPS is not using the cross reference stabs records that GCC puts out. This is a stabs record such as the following: .stabs "a:49=xsmyPragmaClass:",N_LSYM,0x0,0x5,0xffffffe8 The 49=xsmyPragmaClass says that type 49 is a struct (or class) called myPragmaClass whose definition is (hopefully) given in some other compilation unit, and the debugger should go looking for it based on the name. Doing this, without making the time to load a symbol table quadatic or worse in the size of the table, is pretty tricky. If anyone wants to tackle this, I'll give what help I can. Russ Browne Applied MicroSystems Corp.
This archive was generated by hypermail 2.1.4 : Wed Feb 13 2002 - 21:51:33 GMT