Sources Bugzilla – Bug 12937
Support optimized out / unused template methods
Last modified: 2013-02-22 16:05:09 UTC
This is more a GCC extension request but we need to formulate it first. #include <map> int main () { std::map <int, int> v { std::make_pair (1, 2) }; // v.clear (); return v[1]; } 7 return v[1]; (gdb) p v.clear() Cannot evaluate function -- may be inlined after uncommenting the line in the source: (gdb) p v.clear() $1 = void There should be for example some extra .text section in the separate .debug info file containing all the unused methods for a template instance.
We've discussed a few ways to fix this. One way would be to have the compiler emit the out-of-line instances to a special section, which could then be put into the .debug file. Then, gdb could call dlopen to map this into the inferior. Another way would be to write a GCC plugin to transform the out-of-line instances into Python code using gdb's Python API. This could be done, e.g., using David Malcolm's plugin (https://fedorahosted.org/gcc-python-plugin/) and converting gimple to Python code.
*** Bug 12383 has been marked as a duplicate of this bug. ***