3

I have built gdb-7.12 with python support in my ubuntu 14.04 and have enabled pretty printing and configured my gdbinit file by following https://sourceware.org/gdb/wiki/STLSupport.

But whenever i print the size of any container:

p ivec.size()
Cannot evaluate function -- may be inlined

Here is the MCVE i am using

#include <vector>

using namespace std;

int main(){
  vector<int> ivec;
  return 0;
}

I have tried different compiling options

g++-6 -g -O0 -fno-inline-functions -gdwarf-2 Source.cpp --std=c++14

In fact i have tried every combination of the above options, and always the same problem.

I tried switching to gdb-7.11 (also built from source) to see if it fixes the problem and also switched to g++-4.8, none of them seem to fix the issue.

What am i doing wrong? Is there some specific order in which you have to give the options? Is there a way to check if the -O0 option is working?

  • Checkout here: https://stackoverflow.com/questions/40633787/c-stl-gdb-cannot-evaluate-function-maybe-inlined – Gelldur Nov 14 '17 at 02:06

1 Answers1

0

You must have a call to vector::size(), so the function gets compiled. It does not get compiled because this is a class template. I think the call should be also in the same context, but I am not sure about that.

Sogartar
  • 581