Date: Sat, 25 Feb 1995 12:12:38 +0900 From: Stephen Turnbull To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: GDB problem >My problem is that I can't get debug info attached such that GDB will >STEP INTO class member function which are declared/defined in various >header files as well as into template declarations. I don't think the file format produced by the current version of DJGPP can provide good C++ debugging information. You'll have to try "printf debugging" or something similar. Sorry. I suppose the problem here is that class member functions defined in the headers (ie, within the class definition) are inlined. If you were going to produce code that allowed this kind of function to be "stepped into", you would need to maintain a list of all the entry and exit points of inlined functions, since you could not simply place breakpoints at the beginning and end of each function. I note that one of the original poster's uses for the inlined function was to implement a range-checking array type. If you are going to use such arrays a lot, that's going to be one huge list, right? I don't know if inlining can be turned off for C++ altogether; I doubt you want to do that anyway. But if the set of functions that need to be stepped into is small, you can go from the class debuggable { int data; public: int &access (void) { return data; } }; style to class debuggable { int data; public: #if !(step_into_member_functions) inline #endif int &access (void); }; int &debuggable::access (void) { return data; } Ugly, yes. But it should do what you want. Of course, when you turn off the step_into_member_functions switch, the function will now be inlined and this sometimes introduces bugs (at least in earlier versions of the compiler :( ). Another possibility that just occurred to me is that if you take the address of the member function, the compiler must generate a noninlined version. This *could* be stepped into in the usual way, but I don't know what contortions you'd have to go through to get the debugger to actually *do* that. Does the proposed switch to ELF help fix this situation? -- Stephen Turnbull / Yaseppochi-gumi / http://turnbull.sk.tsukuba.ac.jp/ anon FTP: turnbull.sk.tsukuba.ac.jp Check out Kansai-WWW, too ------------> http://pclsp2.kuicr.kyoto-u.ac.jp/