Force generation of an uncalled method?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

I hope this question isn't too elementary. I have a program that maintains objects from a number of templated classes. When debugging, it is particularly useful to print out information in one of these objects with a method I've written---this method digests the information in the object and prints it out in a useful way. So, if the program hits a snag, I'd like to call this method within gdb, as in "p myobject.dumpInfo()". Ordinarily the code will not use this method ever---it's only for me to call in the debugger.

The problem is that I can't get g++ to generate code for this method unless I actually call it in somewhere the code (in which case everything works as intended). I've tried the "used" attribute in the declaration, and optimization is already off. Is there any way to force this method to be compiled?

Thanks,
--Tom
+-----------+----------------+            ____
| Stepleton | tss@xxxxxxxxxx |>-------|\__/_/__
+-----------+----------------+        \________}

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux